nschum / highlight-symbol.el Goto Github PK
View Code? Open in Web Editor NEWEmacs: automatic and manual symbol highlighting
Home Page: http://nschum.de/src/emacs/highlight-symbol/
Emacs: automatic and manual symbol highlighting
Home Page: http://nschum.de/src/emacs/highlight-symbol/
Sorry if this is a bit off-topic, but on http://www.emacswiki.org/emacs/HighlightSymbol you wrote that "Emacs 24.3.50.4 (the bzr build) has in-built support for highlighting symbols . It is bound to M-s h . or C-x w ." That would be really great! But, when compiling 24.3.50.5 I can't find it anywhere...
I use this package to find repeated and overly used words in the English text I write.
I would love to be able to instruct highlight-symbol
to identify and color in the same way words that differ only by a plural (a trailing 's') and/or capitalization. For instance, I would like 'word' and 'words' to be treated in the same way.
How can I achieve this behavior?
it seems the function highlight removal is not for this purpose
thx
Highlighting foo
in the following example in a ruby-mode buffer only highlights the first and last occurrence of foo
.
foo = :bar
bar = :foo
puts foo
One could argue this is working as intended, since foo
is not :foo
. However I was expecting similar behavior to other modes, i.e. highlight foo
for var foo = { foo: "bar" };
in javascript-mode.
Using latest version from marmalade (20160102.1209) with Emacs 24.5.1.
This should be an easy one: would you be willing to tag a new release? Some features on master are not present in the newest release, and us MELPA Stable users would love to be able to use them.
Hi, thanks for this package, really useful!
When I use highlight symbol I am able to highlight but not unhighlight. I need to add highlight-symbol-mode
to the hooks for that file type.
I use this so much, I'd actually really like a global mode... can you please add a (highlight-symbol-global-mode)
function to enable for everything? (as a workaround, adding a find-file hook always works well for this)
Currently, M--
is mapped to ahs-back-to-start
:
(define-key map (kbd "M--") 'ahs-back-to-start)
This is not good because M--
is used for entering negative arguments. Users will be frustrated when ahs is installed that make M--
unusable.
Thanks for the nice mode. However, hightlight symbol mode makes font (color) disappear for magit mode or eww mode. Could you take a look at this issue?
On most Linux and other Unix-like operating system pressing a combination of C-M-f[1-12] cause the screen to switch to a tty.
Changing the binding does't take much as the recommended configuration it's self explanatory however I frankly had a moment of astonishment when the screen went black until a prompt came out, when I pressed the key combination for highlight-symbol-query-replace
.
So my suggestion is to choose a more sensible default key combination to activate the replace functionality, for example C-S-f3 rather than C-M-f3.
Regards
When using flycheck, some symbols get underlined to indicate an error or warning. When you put the cursor on the symbol, it will show the error or warning message in the message buffer. Using highlight-symbol-mode
, you only have highlight-symbol-idle-delay
(default 1.5 seconds) to read the error or warning message, before it is overwritten by the symbol occurrence count.
Windows 10 (64 bit), Emacs 26.1
gradlew assemble
here result:
Nice.
as you can see text BUILD SUCCESSFUL is on green color.
Nice.
Now same on Emacs's shell (M-x shell
)
Is it possible also to green color text BUILD SUCCESSFUL in Emacs's shell forever?
Even after reset Emacs I want only text BUILD SUCCESSFUL in shell to be green color.
Thanks
If I bind highlight-symbol-next/prev to keys (C-c . and C-c ,), then jumping via these keystrokes can break in certain situations whereas jumping via M-x highlight-symbol-next/prev will not. I don't have all the necessary conditions identified, but I've at least identified that highlight-symbol-mode-post-command affects the problem.
This issues started for me as of upgrading to 24.3.1. The behavior did not seem to change between highlight-symbol 1.1 and 1.2.
I have created a video showing the behavior in hopes that that is the easiest way to communicate. It is linked here (if the format doesn't work for you, let me know what format will work, and I'll try to re-encode it):
https://s3.amazonaws.com/www.bstiles.net/highlight-symbol-issue.mp4
The sequence demonstrating the problem is roughly as follows:
At this point, we should have jumped back to the original location, but instead the window does not scroll back to the original position, and we see two cursors --- one flashing at a seemingly arbitrary position at the top of the window and the other not flashing at the symbol location we are trying to jump away from.
If I disable the first condition in highlight-symbol-mode-post-command and retry the steps above, things work as expected. Similarly, if I wrap the calls to highlight-symbol-prev/next in an interactive function that calls keyboard-quit right after highlight-symbol-prev/next, I don't experience the stuck cursor.
Please let me know if there is any further information you need. I can help debug the issue if you can give me some tips what might be going on in the highlight-symbol-mode-post-command function. I don't know your code very well, but I can probably figure it out.
Thanks!
Last update from 6 years ago with un-reviewed PR's.
Is there any interest to transfer this project to a new owner, with some of these PR's reviewed and applied?
(updating melpa to point to the new repository)
With enable highlight-symbol-mode have very bad performance issues on big (~500 lines) files... Cursor freezing all the time!
Thanks for sharing this package! However, after reorganizing my dot-emacs and upgrading highlight-symbol
, highlight-symbol is not working anymore. I'm not sure what caused this.
For example
foo
bar
foo
bar
The cursor is on the first foo. Then I call highlight-symbol
, I see in the minibuffer the message: 2 occurences in the buffer.
But they don't get any visible marking. When I checked the face group, I see they have different colors than my colorscheme. And highlight-symbol-mode
is enabled. Any idea in order to debug this?
Using faces to highlight the symbol means that overlays used by hl-sexp (at least) cover the background contributed by the face.
The hi-lock package had code would use overlays as an alternative to faces. Prior to its removal in highlight-symbol 1.2, I just forced hi-lock (small tweak to hi-lock-set-pattern) to use overlays to workaround the conflict with hl-sexp.
It would be great if highlight-symbol would natively use overlays.
Thanks for the script its working fine. But the problem is I am not able to disable the hightlight using the ctr+f3, it will just changing the color ,not disable the hightlight. iam using emacs 21.4.1
-gopa
While M-x highlight-symbol works just fine, if I use the key binding specified in the highlight-symbol.el README.md, it results in the error "Wrong type argument: commandp, highlight-symbol". Given that it's a simple copy and paste job from the README, I'm at a loss as to what's the culprit here.
This is with Emacs 27.2 and -nw.
I can highlight symbol at point but cannot unhighlight it, no matter how many times i run...
is this a bug only for me?
i am using emacs 24.3 under Windows 7
If a major mode defines a keyword with a regular expression, highlight-symbol removes that highlighting permanently.
Here's an example major mode:
(defvar example-font-lock-keywords
`((,(rx symbol-start "foobar" symbol-end) 0 font-lock-type-face)))
(define-derived-mode example-mode prog-mode "Example"
(setq-local font-lock-defaults '(example-font-lock-keywords)))
If you use this major mode, and enable highlight-symbol-mode, then foobar
is never longer highlighted after point has been on an instance of foobar
.
I suspect font-lock-remove-keywords
(called from highlight-symbol-remove-symbol
) is removing the original regexp from font-lock-keywords
.
Hi, I occur some issue about the default
(defvar highlight-symbol-nav-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\M-n" 'highlight-symbol-next)
(define-key map "\M-p" 'highlight-symbol-prev)
map)
"Keymap for `highlight-symbol-nav-mode'.")
I personal heavily use M-n
M-p
shortcut bind to other function,
I don't hope this hotkey to be changed by this mode, so I binding
to others key.
But, I have no idea to unset M-n, M-p, I need something like this
to do the trick
(add-hook 'highlight-symbol-nav-mode-hook
'(lambda ()
(local-unset-key [(meta n)])
(loal-unset-key [(meta p)]
))
Thanks.
Hello everyone,
I am not sure if this is already implemented. What I want is to make a slection, and highlight all occurrences, the selection can be a string with white spaces.
Thank you for your consideration.
The highlight faces in mmm-default-submode-face
block is invisible.
BTW, show-paren-match
highlight is visible in mmm-default-submode-face
instead; highlight faces of isearch
either. But I don't know how were they implemented. Hope this info is useful.
[Annotation]
Faceshow-paren-match
is used by Emacs built-in mode:
(show-paren-mode t)
(setq show-paren-style 'expression)
It would be great if there were a variant of highlight-symbol-at-point
which prints the number of matches to the minibuffer.
I wonder if there is an option to highlight selection. I think that would be super helpful. I am using evil, is it possible to highlight pattern selected in visual mode?
If I may submit a request: while in org-mode
, and navigating with highlight-symbol-nav-mode
, it would be quite useful if headings would temporarily unfold.
Thank you for highlight-symbol
, it is indispensable to my workflow.
It's a little distracting to have the highlighting following my cursor around. I think a flag to disable highlighting of the symbol under the cursor itself would be useful.
On Emacs version 24.3.50.1 (i386-apple-darwin12.4.0, NS apple-appkit-1187.39):
Very weird bug happen with web-mode fxbois/web-mode#226. highlight-symbol is causing colors to disappear.
Maybe it's highlight-symbol fault, hard to say.
hi-lock.el
define an alias with same name defined in this package. Maybe you need new name for this one.
I don't know if it's a bug but when I'm not in the buffer I don't want to have higlighting, the same as highlight current line or parentheses match work.
Is it possible for highlight-symbol to do the same?
When I use isearch, the background of matches stays visible when it's on the current line, even though the current line has a background of its own (via hl-line-mode).
But when I use highlight-symbol-at-point
, when a match is on the current line, it hides the match's "highlighted" background color.
I'm guessing this is because isearch uses overlays and yours just propertizes the text within the buffer. Overlays would be easier to manage, too, since you just keep a list of them and when you want to un-highlight them, you just call delete-overlay
on each.
It would be nice to have functions for jumping to next/prev instance of any of the currently highlighted symbols.
Hello -- and thanks for your nice package, first of all!
Would it be possible to get more customization options of the colors used? I'd like to use (for example) red on black, blue on black and green on black, but this is currently not possible -- as the foreground can only have one value.
Would you mind making such an extension?
Best regards,
Fabrice
I think it would be nice and useful if information about the currently selected symbol and total count of symbols in the buffer would be displayed in mode-line while stepping through symbols with 'highlight-symbol-prev and 'highlight-symbol-next. Similar to what anzu does with search.
Is it possilbe to hightlight current symbol only if it finds other instances of symbol?
I always use highlight-symbol globally, and have therefore added the usual:
(defun highlight-symbol-mode-on () (highlight-symbol-mode 1))
(define-globalized-minor-mode global-highlight-symbol-mode highlight-symbol-mode highlight-symbol-mode-on)
in order to just enable it globally with
(global-highlight-symbol-mode 1)
Is there a reason why this standard global construct is left out?
I'm using command highlight-symbol
with default set of highlight-symbol-colors
and set highlight-symbol-foreground-color
as "white".
Then, some colors highlighted like yellow, cyan or SpringGreen1, difficult to read the words.
So, My idea is to make highlight-symbol-colors
variable can set foreground color and background color as cons or just background color string(before way) matched foreground color as highlight-symbol-foreground-color
variable.
Here is sample set of highlight-symbol-colors
(setq highlight-symbol-colors
'(("black" . "yellow")
("black" . "DeepPink")
("black" . "cyan")
("white" . "MediumPurple1")
("black" . "SpringGreen1")
("white" . "DarkOrange")
("white" . "HotPink1")
("black" . "RoyalBlue1")
("white" . "OliveDrab")))
;; below is same
(setq highlight-symbol-foreground-color "white")
(setq highlight-symbol-colors
'("yellow"
("black" . "DeepPink")
("black" . "cyan")
"MediumPurple1"
("black" . "SpringGreen1")
"DarkOrange"
"HotPink1"
("black" . "RoyalBlue1")
"OliveDrab"))
And I override highlight-symbol-add-symbol
function.
(defun highlight-symbol-add-symbol (symbol &optional color)
"Override this function for support convenience set foreground and background"
(unless (highlight-symbol-symbol-highlighted-p symbol)
(when (equal symbol highlight-symbol)
(highlight-symbol-mode-remove-temp))
(let ((color (or color (highlight-symbol-next-color)))
f-color b-color)
(unless (facep color)
(if (consp color)
(setq f-color (car color)
b-color (cdr color))
(setq f-color highlight-symbol-foreground-color
b-color color))
(setq color `((background-color . ,b-color)
(foreground-color . ,f-color))))
;; highlight
(highlight-symbol-add-symbol-with-face symbol color)
(push symbol highlight-symbol-list))))
Above override function works find.
May be I can use faces but it has to many sequence(define face, face naming) and inconvenient customize.
But foreground and background cons way is very easy to customize and it also support before way (just list of background colors).
Thank you:)
If I enable hl-line-mode to always highlight the current line of the cursor, the symbol under the cursor would not be highlighted anymore (but matching symbols on other lines would).
Is there a way to avoid the conflict, i.e. highlight the symbol despite having hl-line active?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.