Git Product home page Git Product logo

highlight-symbol.el's People

Contributors

c41x avatar jturner314 avatar nschum avatar rubikitch avatar swsnr avatar tarsius avatar tpapp avatar tsdh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

highlight-symbol.el's Issues

print count of matching symbols

It would be great if there were a variant of highlight-symbol-at-point which prints the number of matches to the minibuffer.

Tag a new release

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.

Doesn't highlight variables in php-mode.

I use php-mode. When I turn on highlight-symbol-mode it highlight function names and strings, but not variables.
test php script
As I see in Messages (Occurrence 2/3 in buffer) it finds symbols fine, but not highlights it.

Odd behavior when highlight-symbol-prev/next bound to keys

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:

  1. Put the point on a symbol.
  2. C-c , to highlight-symbol-prev.
  3. C-c . to highlight-symbol-next.

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!

Conflict with hl-line?

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?

[Idea] I think `highlight-symbol-colors' can be set foreground face colors matched background face colors.

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:)

performance issue

With enable highlight-symbol-mode have very bad performance issues on big (~500 lines) files... Cursor freezing all the time!

highlight-symbol breaks eglot mode with inlay type hints

It looks to me like highlight-symbol-mode causes inlay type hints in eglot to be 'rotated':

Screenshot from 2023-07-09 22-21-27

I see this package isn't maintained at this point, so I'll probably move to symbol-overlay-mode, but I wanted something that could be found if others hit this bug. This took me a while to diagnose.

Is this project still maintained?

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)

M-- should not be mapped

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.

Faces is invisible in mmm-mode block

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]
Face show-paren-match is used by Emacs built-in mode:
(show-paren-mode t)
(setq show-paren-style 'expression)

Displaying current/total information when stepping through symbols

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.

whishlist: how to highlight selection

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.

How to disable the highlight

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

highlight-symbol permanently removes syntax highlighting

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.

Plurals and capitalized words

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?

Part of GNU Emacs?

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...

global mode?

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?

Bug: All colors disappears

On Emacs version 24.3.50.1 (i386-apple-darwin12.4.0, NS apple-appkit-1187.39):

  • Start clean emacs from terminal with emacs -Q
  • Eval (require 'highlight-symbol "~/path/to/highlight-symbol.el") in scratch buffer with C-x C-e.
  • M-x list-colors-display
  • M-x highlight-symbol-mode in Colors buffer.
  • After 1.5 seconds delay (because of highlight-symbol-idle-delay), all colors in the entire buffer Colors disappear, regardless of point position.

Use overlays rather than faces for highlighting

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.

Get more customization of color

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

Add custom variable to turn off symbol occurrence count in highlight-symbol-mode

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.

global mode

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)

Can't color specific text in shell (M-x shell)

Windows 10 (64 bit), Emacs 26.1

gradlew assemble
here result:

Q0oLu

Nice.
as you can see text BUILD SUCCESSFUL is on green color.

Nice.

Now same on Emacs's shell (M-x shell)

zLYGi

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

Symbols starting or ending with colon not highlighted (ruby-mode)

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.

Unfolding headings whjile in org-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.

Is it possible to highlight selection

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?

Highlight symbol marks are not visible?

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?

Add highlight-symbol-nav-mode-hook

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.

More sensible default binding for highlight-symbol-query-replace

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

Highlighted background hidden when using `hl-line-mode`

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.