elp-revive / auto-highlight-symbol Goto Github PK
View Code? Open in Web Editor NEWAutomatic highlighting current symbol minor mode.
License: GNU General Public License v3.0
Automatic highlighting current symbol minor mode.
License: GNU General Public License v3.0
Navigation via, for instance, ahs-forward
only navigates the visible instances of the symbol at point which is not what the user expects.
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)".
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.
C-x b
test
RET
abc
def
abc
def
With the cursor on the last word def
M-x auto-highlight-symbol-mode
RET
def
becomes highlighted.up
(arrow key)abc
becomes highlighted,M-right
or M-left
symbol.ahs-select: Wrong type argument: overlayp, nil
The cursor should move to the next/previous symbol.
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.
auto-highlight-symbol-20210705.1351
GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26
Windows 21H1
What about defaulting ash-modes
to '(prog-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.
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)
test
abc
abc
M-x
auto-highlight-symbol-mode
RET
Error running timer ‘ahs-idle-function’: (wrong-type-argument number-or-marker-p nil)
The symbol at the cursor should be highlighted
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
auto-highlight-symbol-20210708.1057
GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26
Windows 21H1
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 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.
@gennad Hi Gennadiy,
auto-highlight-symbol is missing in MELPA repository which is a dependency of EDTS (see issue sebastiw/edts/issues/147).
Can you make a recipe for ahs
in MELPA ?
Thank you,
syl20bnr
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
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.
Looks like the names of the faces introduced in: 7d7d89a
are mistyped.
i.e., perhaps it should be ahs-plugin-default-face
instead of: ahs-plugin-defalt-face
The cursor jumps to the wrong location, when trying to navigate to the next symbol.
When the same buffer is open in two windows.
C-x b
test
RET
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.
to
:C-s
to
RET
M-x auto-highlight-symbol-mode
RET
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
Alt Tab
to unfocus Emacs (switch to another application)Alt Tab
again to focus Emacs.to
are highlighted in the top window.you
are highlighted in the bottom window.With the top window selected:
M-right
The cursor jumps to the o
in clone
(fourth word after the comma).
The cursor should have jumped to the second instance of to
(seventh word).
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
.
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
.
auto-highlight-symbol-20210708.1057
GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26
Windows 21H1
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
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.
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
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
Repro:
Create a document with the following:
трахаеш
Move point onto the word, M-x ahs-forward
Result: Wrong type argument: stringp, none
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.