Code Monkey home page Code Monkey logo

auto-highlight-symbol's People

Contributors

bgwines avatar cagdasalagoz avatar dependabot[bot] avatar jcs090218 avatar squiter 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

Watchers

 avatar  avatar  avatar  avatar

auto-highlight-symbol's Issues

ahs-edit-mode does not work

After calling ahs-edit-mode, the color is changed to edit state. But when i type something, only things under cursor position is modified. I have also tested it with "emacs -q". There is also an error message "Error in post-command-hook (ahs-edit-post-command-hook-function): (wrong-type-argument overlayp nil)".

ahs-forward or ahs-backward before symbol highlighted: Wrong type argument: overlayp, nil

The messages buffer shows:

ahs-select: Wrong type argument: overlayp, nil

when trying to navigate to the next/previous symbol,
before the highlight has appeared.

Reproduction steps

  • Open a new buffer: C-x b test RET
  • Type or copy and paste:
abc
def
abc
def

With the cursor on the last word def

  • Enable ahs mode: M-x auto-highlight-symbol-mode RET
    After a second, both instances of def becomes highlighted.
  • The following steps need to be performed within a second:
    Move the cursor to the line above: up (arrow key)
    and before the instances of abc becomes highlighted,
    Try to move to the next/prev symbol: M-right or M-leftsymbol.

Observed

ahs-select: Wrong type argument: overlayp, nil

Expected

The cursor should move to the next/previous symbol.

Notes

It seems like the highlight symbol timer is reset
every time one tries to move to the next/prev symbol,
because the error message keeps repeating when pressing:
M-right or M-left within a second.

When one waits and the highlight appears,
then the key bindings navigate to the next/prev symbol,
as expected.

System info

auto-highlight-symbol-20210705.1351
GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26
Windows 21H1

global-auto-highlight-symbol-mode doesn't work in go-mode

First of all - big thank you for this package, ❤️ it. Though having minor problem - I have (global-auto-highlight-symbol-mode t) in my config and it works for e.g. ruby-mode, but for some reason I have to activate the package manually for go-mode, is there an easy way to debug? Thanks.

Error running timer ‘ahs-idle-function’: (wrong-type-argument number-or-marker-p nil)

An error appears when enabling auto-highlight-symbol-mode in a new buffer:

Error running timer ‘ahs-idle-function’: (wrong-type-argument number-or-marker-p nil)

Reproduction steps

  • Create a new buffer test
  • Type:
abc
abc
  • Enable ahs mode: M-x auto-highlight-symbol-mode RET
  • Wait 1 second

Observed

Error running timer ‘ahs-idle-function’: (wrong-type-argument number-or-marker-p nil)

Expected

The symbol at the cursor should be highlighted

Notes

Moving the cursor to another line, either up or down,
highlights the symbol under the cursor.

In the issue:
#8 (comment)
It was suggested to require the package first.

Make sure you require auto-higlight-symbol before calling these functions. These functions aren't autoload.

It didn't help to add:

(require 'auto-highlight-symbol)

to the init.el

It wasn't caused by the most recent update either,
because it also happened with the previous version:
auto-highlight-symbol-20210705.1351

The symbol is highlighted directly,
without the timer error message,
if the test buffer, is switched to: M-x emacs-lisp-mode RET
before enabling: M-x auto-highlight-symbol-mode RET

The default major mode when creating a new buffer is: fundamental-mode

System info

auto-highlight-symbol-20210708.1057
GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26
Windows 21H1

Broken smerge-mode

I had a somewhat broken smerge-mode (git diff3 resolution), and, it took some time, but I finally narrowed it down to auto-highlight-symbol commit bc1564a (thanks git-bisect). I have no idea how it's related to smerge, but it's quite non-mistakable: on bc1564a8d5 smerge is borken, on bc1564a8d5~ it is not.

To reproduce the bug, I simply create a test.py file (does not happen with a .txt file...):

<<<<<<< A
a
||||||| C
=======
b
>>>>>>> B

Enable ahs with M-x auto-highlight-symbol-mode (if not already), then M-x smerge-mode, then M-x smerge-keep-upper and you get:

<<<<<<< A
a

instead of:

a

All the smerge-keep-* seem borken.

If I checkout auto-highlight-symbol to bc1564a8d5~, then everything works as expected again.

I don't see any error in *Messages*, I use emacs 27.1.

EDIT: add M-x auto-highlight-symbol-mode repro step

Navigation not possible before ahs-idle-interval has passed

Navigation should be possible before ahs-idle-interval has passed.

The advice

(defadvice ahs-select (before idle-do-hl activate)
    (ahs-idle-function))

currently fixes things but I believe this should be the default behavior implemented without an advice.

Turning the mode off should stop the ahs-idle-function

This is a very minor and "cosmetic" issue of course.

(define-minor-mode auto-highlight-symbol-mode
  "Toggle Auto Highlight Symbol Mode"
  :group 'auto-highlight-symbol
  :lighter ahs-mode-line
  (if auto-highlight-symbol-mode
      (ahs-init)
    (ahs-clear))) ; <---- does not stop/clear timer

Recognizing separated words

It's a question I unfortunately couldn't find answer for. It seems Spacemacs uses this package and when you highlight things like foo/bar it selects entire thing, whereas in most cases only a part needed. I'm wondering if it's possible to tell ahs to recognize slash as a separator? Thanks in advance.

Same buffer in two windows, next/prev symbol issues

The cursor jumps to the wrong location, when trying to navigate to the next symbol.
When the same buffer is open in two windows.

Reproduction steps

  • Open a new buffer: C-x b test RET
  • Copy and paste:
If you would like to contribute to this project, you may either clone and make pull requests to this repository. Or you can clone the project and establish your own branch of this tool. Any methods are welcome!

The text is from the readme contribution section:
https://github.com/jcs-elpa/auto-highlight-symbol#contribution

  • Move the cursor to the second word: you

  • Split the frame into two windows: C-x 2
    The inactive cursor in the bottom window (shown as a hollow rectangle),
    is on the y in the second word you.

The active cursor (black rectangle) is in the top window.

  • Move the active cursor to the fifth word to:
    C-s to RET
  • Enable ahs mode: M-x auto-highlight-symbol-mode RET
    A most likely unrelated error message is shown (the jump issue has been encountered without the error message being shown, possibly when the major mode wasn't fundamental-mode):
Error running timer ‘ahs-idle-function’: (wrong-type-argument number-or-marker-p nil)

It's been reported in a separate issue:
Error running timer ‘ahs-idle-function’: (wrong-type-argument number-or-marker-p nil) #10

  • Press Alt Tab to unfocus Emacs (switch to another application)
  • Press Alt Tab again to focus Emacs.
    Now the three instances of to are highlighted in the top window.
    And the three instances of you are highlighted in the bottom window.

With the top window selected:

  • Try to navigate to the next highlighted symbol: M-right

Observed

The cursor jumps to the o in clone (fourth word after the comma).

Expected

The cursor should have jumped to the second instance of to (seventh word).

Notes

In the top window, move back the cursor to the fifth word to.

Keep navigating to the next symbol M-right.
The cursor jumps to three places:
The o in clone in the first sentence.
Between the and project in the second sentence
Then back to the starting location, after the fifth word to.

The orange highlight in the top window doesn't move,
while jumping to the next symbol.
Until the cursor is stopped on another word,
then the highlighted symbols update.

But the orange highlight in the bottom window,
jumps between each instance of the highlighted word you.

A possible cause

It seems like the cursor in the top window is jumping forwards by the same amount of characters, as the distance between the bottom windows highlighted words.

For example in the top window:
From the end of the fifth word to,
to (but not including) the o in the word clone,
is 46 characters (including the leading space):

 contribute to this project, you may either cl

In the bottom window:
From the end of the second word you,
to the second instance of you (before the y),
is also 46 characters (including the leading space).

 would like to contribute to this project, you

The same behavior can be seen when, selecting the bottom window
and navigating to the next symbol.

The cursor in the bottom window jumps the same distance as between the instances of you in the top window.

And the orange highlight in the top window jumps between the instances of the word to.

System info

auto-highlight-symbol-20210708.1057
GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26
Windows 21H1

Compatibility?

Hi,
I'm wondering about the compatibility of AHS and different Emacs versions.

Code looks like it has support for earlier Emacs versions
https://github.com/jcs-elpa/auto-highlight-symbol/blob/1a54a61fda6206c5e0fa843d16635133241292ba/auto-highlight-symbol.el#L208
but at the same time it only supports Emacs 26.1+
https://github.com/jcs-elpa/auto-highlight-symbol/blob/1a54a61fda6206c5e0fa843d16635133241292ba/auto-highlight-symbol.el#L13

Ubuntu 18.04 comes with Emacs 25 support, so that is why I'm wondering, is AHS compatible with it?
https://ubuntu.pkgs.org/18.04/ubuntu-main-amd64/emacs_47.0_all.deb.html

`ahs-change-range` no longer works after updating to lastest melpa

After updating from 20210108.1841 to 20210715.1416 I've noticed that the default range was switched from whole buffer to display area. But what's worse that after using ahs-change-range to switch to a different range, ahs stops working: whatever was highlighted stays highlighted, even if I move my cursor around.

I've reproduced it with this tiny config:

(custom-set-variables
 '(package-archives
   '(("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa-stable" . "http://stable.melpa.org/packages/")
     ("melpa" . "https://melpa.org/packages/"))))

; auto-highlight bindings
(setq-default auto-highlight-symbol-mode-map
              (let ((map (make-sparse-keymap)))
                (define-key map (kbd "M-<up>"     ) 'ahs-backward            )
                (define-key map (kbd "ESC <up>"   ) 'ahs-backward            )
                (define-key map (kbd "M-<down>"   ) 'ahs-forward             )
                (define-key map (kbd "ESC <down>" ) 'ahs-forward             )
                (define-key map (kbd "M-S-<up>"   ) 'ahs-backward-definition )
                (define-key map (kbd "M-S-<down>" ) 'ahs-forward-definition  )
                (define-key map (kbd "M--"        ) 'ahs-back-to-start       )
                (define-key map (kbd "C-x C-'"    ) 'ahs-change-range        )
                (define-key map (kbd "C-x C-a"    ) 'ahs-edit-mode           )
                map))
(global-auto-highlight-symbol-mode 1)

After typing C-x C-', the highlight stops updating.
Using Emacs 27.2 on Linux.

`auto-highlight-symbol`-related functionality broken in Spacemacs

Is there a recommended way to disable the new highlighting functionality? This may seem like a strange request given the name/nature of this project, but it seems that I'm not the only one wondering:
syl20bnr/spacemacs#14880

Excluding the entire package isn't a great solution since Spacemacs relies on this package for some of its functionality:
https://github.com/syl20bnr/spacemacs/blob/532ad2567cba1d57d09e102c385315e7cfa829ec/layers/%2Bspacemacs/spacemacs-navigation/funcs.el#L91

install/update: void: ahs-focus-out and void ahs-focus-in

After installing or updating: auto-highlight-symbol

When the Emacs frame loses/gains focus when switching to/from another application.

Then the messages buffer shows:

if: Symbol’s function definition is void: ahs-focus-out
if: Symbol’s function definition is void: ahs-focus-in

Restarting Emacs after the install/update fixes it.
But is it possible to handle it without having to restart?

System info
auto-highlight-symbol-20210705.1351
GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26
Windows 21H1

Does not work in text mode

Repro:
Create a document with the following:

трахаеш

Move point onto the word, M-x ahs-forward
Result: Wrong type argument: stringp, none

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.