Code Monkey home page Code Monkey logo

symbol-overlay's Introduction

Melpa Status Melpa Stable Status Build Status

Symbol Overlay

Highlight symbols with overlays while providing a keymap for various operations about highlighted symbols. It was originally inspired by the package highlight-symbol. The fundamental difference is that in symbol-overlay every symbol is highlighted by the Emacs built-in function overlay-put rather than the font-lock mechanism used in highlight-symbol.

What's New!

20190306:

New commands symbol-overlay-jump-first (key "<") and symbol-overlay-jump-last (key ">") are now enabled.

20190305:

New customizable variable symbol-overlay-displayed-window is introduced to control the overlay behavior at symbol-overlay-mode. If it is non-nil, occurrences outside the displayed window will not be counted or highlighted.

20170826:

symbol-overlay-toggle-in-scope now affects both global and in-scope highlighting. symbol-overlay-rename now uses the original symbol name as the initial text in minibuffer. New command symbol-overlay-count for counting symbol at point. And other improvements.

20170426:

Minor-mode symbol-overlay-mode for auto-highlighting is now enabled.

20170423:

Toggling to isearch-mode is now enabled. Try symbol-overlay-isearch-literally via "s" to search the not-quoted symbol in isearch-mode.

20170420:

Toggling overlays to be showed in buffer or only in scope is now enabled. When symbol is highlighted in scope, all related operations is narrowed to the scope, too. Try symbol-overlay-toggle-in-scope via "t". This feature is applicable only for languages that support the lisp function narrow-to-defun. Otherwise you may specify beginning-of-defun-function and end-of-defun-function on your own.

20170417:

Auto-refresh is now enabled. Every time the highlighted text is changed or a new occurrence shows up, the buffer will refresh automatically.

Two new commands added: symbol-overlay-save-symbol for copying the current symbol, symbol-overlay-echo-mark for undoing a recent jump.

Advantages

Fast

When highlighting symbols in a buffer of regular size and language, overlay-put behaves as fast as the traditional Highlighting method font-lock. However, for a buffer of major-mode with complicated keywords syntax, like haskell-mode, font-lock is quite slow even the buffer is less than 100 lines. Besides, when counting the number of highlighted occurrences, highlight-symbol will call the function how-many twice, which could also result in an unpleasant delay in a large buffer. Those problems don't exist in symbol-overlay.

Convenient

When putting overlays on symbols, an auto-activated overlay-inside keymap will enable you to call various useful commands with a single keystroke.

Powerful

  • Toggle all overlays of symbol at point: symbol-overlay-put
  • Jump between locations of symbol at point: symbol-overlay-jump-next & symbol-overlay-jump-prev
  • Switch to the closest symbol highlighted nearby: symbol-overlay-switch-forward & symbol-overlay-switch-backward
  • Minor mode for auto-highlighting symbol at point: symbol-overlay-mode
  • Remove all highlighted symbols in the buffer: symbol-overlay-remove-all
  • Copy symbol at point: symbol-overlay-save-symbol
  • Toggle overlays to be showed in buffer or only in scope: symbol-overlay-toggle-in-scope
  • Jump back to the position before a recent jump: symbol-overlay-echo-mark
  • Jump to the definition of symbol at point: symbol-overlay-jump-to-definition
  • Isearch symbol at point literally, without regexp-quote the symbol: symbol-overlay-isearch-literally
  • Query replace symbol at point: symbol-overlay-query-replace
  • Rename symbol at point on all its occurrences: symbol-overlay-rename

Usage

To use symbol-overlay in your Emacs, you need only to bind these keys:

(require 'symbol-overlay)
(global-set-key (kbd "M-i") 'symbol-overlay-put)
(global-set-key (kbd "M-n") 'symbol-overlay-switch-forward)
(global-set-key (kbd "M-p") 'symbol-overlay-switch-backward)
(global-set-key (kbd "<f7>") 'symbol-overlay-mode)
(global-set-key (kbd "<f8>") 'symbol-overlay-remove-all)

Default key-bindings defined in symbol-overlay-map:

"i" -> symbol-overlay-put
"n" -> symbol-overlay-jump-next
"p" -> symbol-overlay-jump-prev
"w" -> symbol-overlay-save-symbol
"t" -> symbol-overlay-toggle-in-scope
"e" -> symbol-overlay-echo-mark
"d" -> symbol-overlay-jump-to-definition
"s" -> symbol-overlay-isearch-literally
"q" -> symbol-overlay-query-replace
"r" -> symbol-overlay-rename

You can re-bind the commands to any keys you prefer by simply writing

(define-key symbol-overlay-map (kbd "your-prefer-key") 'any-command)

Or you may prefer to overwrite the keymap

(let ((map (make-sparse-keymap)))
  (define-key map (kbd "key1") 'command-1)
  (define-key map (kbd "key2") 'command-2)
  (setq symbol-overlay-map map))

As a final example, you can define a handy set of keys using transient: see the snippet posted here.

symbol-overlay's People

Contributors

akirak avatar bad-ptr avatar blindingdark avatar cireu avatar dakra avatar emacswatcher avatar jguenther avatar ksqsf avatar langston-barrett avatar leandrocardoso avatar mattbeshara avatar minad avatar mpenet avatar purcell avatar roife avatar sadboy avatar syohex avatar tarsius avatar vlachjosef avatar walseb avatar wbolster avatar wilfred avatar wolray avatar yulapshun 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

symbol-overlay's Issues

Order not respected

Hello, first, thanks for this highlight package that uses overlays, and thus allows to highlight the line, while still being visible!!

Now, just played with it, and the M-n/p key bindings, with common words such as "in" and "if" in a buffer. It's weird, it's skipping some patterns.

(It's good that you can move from one highlight to the next highlighted occurrence, whichever the pattern -- very nice!)

Please create a release

Please create a release tag. That would make this package available to users of Melpa Stable.

Overlay conflicts with eglot

I'm using (trying out) eglot with python-mode and it highlights the symbol-at-point with an overlay. I used symbol-overlay-put and other occurrences of the symbol highlighted (more clearly), but the keymap symbol-overlay installs didn't work. If I typed n the character was just inserted (eglot's overlay had a modification-hooks property if that matters), it didn't run symbol-overlay-jump-next.

I assumed it was because of conflicting overlays and added a 'priority 100 to the symbol-overlay overlay and it worked great. I don't know as there's a good solution (there was also a flymake overlay at point) but I think it would help if symbol-overlay included a priority in the overlays it uses and gives the user a symbol-overlay-priority user option to customize. That way we could resolve whatever conflicts we come across.

Highlight only variables that are in scope

It would be nice to have something like this
but a bit more generic so someone can write "modules" for different languages so it's not only js2-mode specific.

This should probably be an extra function, so someone could highlight all words anywhere
(via regex) like now or highlight only in the current scope.
Imho, it would be really useful for refactoring.

I see that it's quite different from what symbol-overlay internally does now,
you can close this issue if you feel this is out of the scope of this package.

symbol-overlay-mode dont work?

我的配置

(use-package symbol-overlay
  :defer t
  :config
  (symbol-overlay-mode +1)
  (global-set-key (kbd "M-i") #'symbol-overlay-put)
  )

复现:

emacs -Q

(add-to-list 'load-path "/Users/lukertty/.emacs.d/elpa-25.2.1/symbol-overlay-20170604.2240")
(require 'symbol-overlay)
(symbol-overlay-mode +1)

M-x eval-buffer

结果:
不是所有的symbol 都高亮,比如

with-current-buffer
compilation-scroll-output
point-max 
page-break-lines-mode
"127.0.0.1"

等symbol 并没有高亮

Allow jumping to the first and last occurrence of a symbol

I've been trying symbol-overlay as an alternative to symbol-highlight, and it works really well. One feature I'm missing is the ability to go the first or last instance of a symbol in a buffer.

Would you be interested in a PR for this?

org mode

不能像C-s一样展开折叠项

overlay the active region

When I mark an active region and use symbol-overlay, it doesn't highlight the region, is it supported? If yes, how can I do it?

Thanks!

void-variable clojure-font-lock-extra-keywords

Hi,

first of all thanks for this package, one of the most used ones for me.

I updated it this morning, and in a Clojure buffer now I get this:

Debugger entered--Lisp error: (void-variable clojure-font-lock-extra-keywords)
  (append clojure-font-lock-extra-keywords '("defn" "def" "let" "deftest" "is"))
  (symbol-overlay-match-keyword-list symbol (append clojure-font-lock-extra-keywords '("defn" "def" "let" "deftest" "is")))
  symbol-overlay-ignore-function-clojure(#("cases.details/get-details" 0 13 (face font-lock-type-face cider-locals ("woz-check-type" "previous-user-flow" "case-id" "request" "body" "ctx" "valuation-config" "woz-scraper" "db" "params" "case-details" "prev-input" "woz-year" "tax-year" "case-ref" "property-id") fontified t help-echo cider--help-echo) 13 25 (cider-locals ("woz-check-type" "previous-user-flow" "case-id" "request" "body" "ctx" "valuation-config" "woz-scraper" "db" "params" "case-details" "prev-input" "woz-year" "tax-year" "case-ref" "property-id") fontified t help-echo cider--help-echo)))
  funcall(symbol-overlay-ignore-function-clojure #("cases.details/get-details" 0 13 (face font-lock-type-face cider-locals ("woz-check-type" "previous-user-flow" "case-id" "request" "body" "ctx" "valuation-config" "woz-scraper" "db" "params" "case-details" "prev-input" "woz-year" "tax-year" "case-ref" "property-id") fontified t help-echo cider--help-echo) 13 25 (cider-locals ("woz-check-type" "previous-user-flow" "case-id" "request" "body" "ctx" "valuation-config" "woz-scraper" "db" "params" "case-details" "prev-input" "woz-year" "tax-year" "case-ref" "property-id") fontified t help-echo cider--help-echo)))
  (progn (funcall f symbol))
  (if f (progn (funcall f symbol)))
  (let ((f (cdr (assoc major-mode symbol-overlay-ignore-functions)))) (if f (progn (funcall f symbol))))
  symbol-overlay-ignored-p(#("cases.details/get-details" 0 13 (face font-lock-type-face cider-locals ("woz-check-type" "previous-user-flow" "case-id" "request" "body" "ctx" "valuation-config" "woz-scraper" "db" "params" "case-details" "prev-input" "woz-year" "tax-year" "case-ref" "property-id") fontified t help-echo cider--help-echo) 13 25 (cider-locals ("woz-check-type" "previous-user-flow" "case-id" "request" "body" "ctx" "valuation-config" "woz-scraper" "db" "params" "case-details" "prev-input" "woz-year" "tax-year" "case-ref" "property-id") fontified t help-echo cider--help-echo)))
  (not (symbol-overlay-ignored-p symbol))
  (and symbol (not (symbol-overlay-assoc symbol)) (not (symbol-overlay-ignored-p symbol)))
  (if (and symbol (not (symbol-overlay-assoc symbol)) (not (symbol-overlay-ignored-p symbol))) (progn (symbol-overlay-remove-temp) (save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char (point-min)) (let ((re (symbol-overlay-regexp symbol))) (re-search-forward re nil t) (let ((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...))) (if p (progn (symbol-overlay-put-one symbol) (setq symbol-overlay-temp-symbol symbol))))))))
  (let* ((case-fold-search nil) (symbol (symbol-overlay-get-symbol t)) p) (if (and symbol (not (symbol-overlay-assoc symbol)) (not (symbol-overlay-ignored-p symbol))) (progn (symbol-overlay-remove-temp) (save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char (point-min)) (let ((re ...)) (re-search-forward re nil t) (let (...) (unwind-protect ... ...)) (if p (progn ... ...))))))))
  (progn (let* ((case-fold-search nil) (symbol (symbol-overlay-get-symbol t)) p) (if (and symbol (not (symbol-overlay-assoc symbol)) (not (symbol-overlay-ignored-p symbol))) (progn (symbol-overlay-remove-temp) (save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char (point-min)) (let (...) (re-search-forward re nil t) (let ... ...) (if p ...))))))))
  (if symbol-overlay-mode (progn (let* ((case-fold-search nil) (symbol (symbol-overlay-get-symbol t)) p) (if (and symbol (not (symbol-overlay-assoc symbol)) (not (symbol-overlay-ignored-p symbol))) (progn (symbol-overlay-remove-temp) (save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char ...) (let ... ... ... ...))))))))
  symbol-overlay-maybe-put-temp()
  (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp))
  (progn (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp)))
  (if (and (buffer-live-p buf) (eq (window-buffer) buf)) (progn (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp))))
  symbol-overlay-idle-timer(#<buffer public_api.clj>)
  apply(symbol-overlay-idle-timer #<buffer public_api.clj>)
  timer-event-handler([t 0 0 500000 t symbol-overlay-idle-timer (#<buffer public_api.clj>) idle 0])

These are some extra details about my system to add more context:

GNU Emacs 28.0.50

➤ Master branch commit:
   b215e83a784be1118bb5d729f17597c4f1c62b52
   Improve support for the Cham script and languages

➤ Configured with the following options:
   --with-harfbuzz
   --with-json
   --with-mailutils

➤ Configured with the following features:
   ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM
   GSETTINGS GTK3 HARFBUZZ INOTIFY JPEG JSON LCMS2 LIBOTF LIBSELINUX
   LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY PDUMPER PNG RSVG SOUND
   THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM ZLIB

➤ Running on:
   Ubuntu 20.04 LTS
   GNOME Shell 3.36.4 (x11)
   GTK+ Version 3.24.18, cairo version 1.16.0

Support not putting boundaries on match

Would be nice if, eg, point is on foo and symbol-overlay-put is called and it's able to also match foo-bar in same group.

Not sure if it's also useful to exclude a head/beginning boundary. Actually, it probably is for things like clojure keys that you want to match to a similarly named function. So :some-fn is matched when point is on some-fn.

Hide unmatched lines?

Hi, thanks for this great package! Using iedit and multiple-cursor you can toggle hiding unmatched lines which is sometimes useful to get an overview of all matches without having to navigate through the symbols. If you are interested I could try to implement it.

highlighting error

When I execute command symbol-overlay-put command, get this error:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  symbol-overlay-count("\\_<report\\_>" "salmon")
  symbol-overlay-put()
  funcall-interactively(symbol-overlay-put)
  call-interactively(symbol-overlay-put nil nil)
  command-execute(symbol-overlay-put)

Symbol-overlay conflicts with haskell-mode

Symbol-overlay-mode will cause Emacs to freeze with haskell-mode enabled,I am not sure it is cause by haskell-mode or symbol-overlay.

Steps to reproduce the issue:

  1. Back up your current configuration .emacs.d file with another name
  2. Create an .emacs file in the current user's HOME directory (for example, my HOME is the C:\Users\Aqua directory), and copy the following code to the .emacs file.
(require 'package)
(add-to-list 'package-archives '( "melpa" . "https://melpa.org/packages/") t)
(package-initialize)

(require 'symbol-overlay)
(global-set-key (kbd "M-i") 'symbol-overlay-put)
(global-set-key (kbd "M-n") 'symbol-overlay-switch-forward)
(global-set-key (kbd "M-p") 'symbol-overlay-switch-backward)
(global-set-key (kbd "<f7>") 'symbol-overlay-mode)
(global-set-key (kbd "<f8>") 'symbol-overlay-remove-all)

(require 'haskell-mode)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
  1. Start Emacs, an error will be raised now, because the required packages have not been installed.
  2. Manually refresh the package contents and install haskell-mode and symbol-overlay
M-x package-refresh-contents
M-x package-install RET haskell-mode
M-x package-install RET symbol-overlay
  1. Restart Emacs, now it can start normally.

  2. C-x, C-f Create a test.hs file in any directory, press to turn on symbol-overlay-mode. Enter the following content from the beginning in the empty test.hs file.

triples = [(a,b,c) | c <- [1..10], a <- [1..c], b <- [1..a]]
  1. When I input the third 1, and then input a space or . It will be stuck (as shown in the figure below, the cursor now is at the position indicated by the red arrow).
    image

  2. press C-g can go back to normal , and get error from Messages :

Symbol-Overlay mode enabled in current buffer
Error during redisplay: (internal--syntax-propertize 44) signaled (quit)
Error during redisplay: (internal--syntax-propertize 57) signaled (quit)
  1. if at step 7 can't reproduce issue, you can move cursor back to the the position after the second 1 , and delete ..c , and input ..c again.

Tested on:
Emacs 28.0.50 native compile and Emacs 27.2
OS: macOS Big Sur 11.5 and Windows 10

after-change-functions may be nil

According to the docstring of after-change-functions,

If an unhandled error happens in running these functions,
the variable’s value remains nil. That prevents the error
from happening repeatedly and making Emacs nonfunctional.

(add-hook 'after-change-functions 'symbol-overlay-refresh)

Use "Rename to:" as symbol-overlay-rename prompt

I use symbol-overlay-rename infrequently and when I do it prompts me with "Rename:" and the current name of the symbol. I'm never sure if behaves like replace-string and I'm supposed to first enter the current name and then it will prompt me for the new name; or if I'm just supposed to enter the new name. Adding " to" to the prompt would make this clear.

First word on the line is not highlighted in c++mode

Steps to reproduce

Assuming symbol-overlay is installed:

  1. execute emacs -Q --eval "(progn (package-initialize) (c++-mode) (insert \"return return\") (symbol-overlay-mode))" (Emacs window should appear with scratch buffer with return return text).
  2. put the caret upon a return word

Expected

Both returns gets highlighted

Actual

Nothing happens.

Versions

Emacs version 27.0.50, built from git
symbol-overlay version 20190305.1643 from elpa.

upd: simplified steps.

symbol-overlay-mode

Hi, I like the package, especially since highlight-symbol doesn't seem to be maintained anymore.

I always use highlight-symbol-mode which is a minor mode that always
highlights automatically the symbol under the cursor.

Would be a nice feature for symbol-overlay as well.

Also how comes o and u are default bindings for next and prev?
Would have expected either n/p or maybe f/b.

Thanks :)

Tag a new release

I'm a big fan of symbol-overlay. Thanks @purcell for you help on maintenance!

I think symbol-overlay is stable enough for a new release. Make a release can help user who prefer melpa-stable.

A new release can also give me a reason to update this package in Guix system. Thanks!

`symbol-overlay-list-all`

I find myself using SOM so much that I often ask: what have I actually highlighted in this buffer?? Then I jump all around to inspect those important symbols. It'd be nice to just see a simple list (maybe in minibuffer).

sh-mode problem

The behavior of symbol-overlay is not right in sh-mode.I cannot jump from a variable like "$sample" to "$sample/$somethingelse".

Highlight even when there are occurrences outside of the visible window

I've found it confusing that symbol-overlay-mode doesn't highlight the symbol if the other occurrences aren't visible.

This was a feature I loved with highlight-symbol-mode -- I could see if a function was used by just by putting point on it.

Is this intentional, or can it be configured? I can see a mention of this behaviour in the docstring of symbol-overlay-maybe-put-temp.

Don't highlight symbols that appear in strings

Mostly, these are just "coincidental", and don't need to be brought to the user's attention. Most major modes highlight string literals, so there should be some way to detect and avoid them.

Allow customization of the overlay face

Rather than hardcoding a ,color background and a black foreground, allow for customization of the overlay face.

The defaults might not look good in all themes, and might override decorations from other features, so please allow users to override the defaults.

Request: Add regexp support

Wanted

Like highlight-regexp, but with overlay functionality.

Reproduction steps

sample code extracted for illustration from https://raw.githubusercontent.com/bbatsov/prelude/master/utils/installer.sh

install_prelude() {
  printf " Cloning Emacs Prelude's GitHub repository...\n$RESET"

  if [ x$PRELUDE_VERBOSE != x ]; then
    /usr/bin/env git clone $PRELUDE_URL "$PRELUDE_INSTALL_DIR"
  else
    /usr/bin/env git clone $PRELUDE_URL "$PRELUDE_INSTALL_DIR" >/dev/null
  fi

  if ! [ $? -eq 0 ]; then
    printf "$RED A fatal error occurred during Prelude's installation. Aborting..."
    exit 1
  fi
}

make_prelude_dirs() {
  printf " Creating the required directories.\n$RESET"
  mkdir -p "$PRELUDE_INSTALL_DIR/savefile"
}

When overlay string PRELUDE_INSTALL_DIR inside "$PRELUDE_INSTALL_DIR" with symbol-overlay-put, it would not highlight $PRELUDE_INSTALL_DIR inside "$PRELUDE_INSTALL_DIR/savefile"

image

Don't log navigation steps to the messages buffer

The messages buffer gets flooded with every symbol navigation step.

defun: 1/42 <-- jump-first
defun: 42/42 <-- jump-last
interactive: 17/17 <-- switch-forward
defun: 42/42 <-- switch- backward
defun: 41/42 <-- jump-prev
defun: 40/42
defun: 39/42
defun: 38/42
defun: 37/42
defun: 36/42
defun: 37/42 <-- jump-next
defun: 38/42
defun: 39/42
defun: 40/42

This can be prevented by wrapping (let (message-log-max nil) BODY) around the navigation code. Then the messages only appear in the minibuffer, but they won't be written to the messages buffer.

It might be enough to just wrap these commands:
symbol-overlay-jump-next, ..-prev, ..-first, ..-last
symbol-overlay-switch-forward, ..-backward

System info

symbol-overlay.el

;; Version: 4.1
;; Package-Version: 20190305.1643

GNU Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-04-13
Windows 10 Version 1803

args-out-of-range error

Debugger entered--Lisp error: (args-out-of-range 1 226)
  symbol-overlay-narrow(nil t)
  symbol-overlay-maybe-put-temp()
  apply(symbol-overlay-maybe-put-temp nil)
  timer-event-handler([t 0 0 100000 t symbol-overlay-maybe-put-temp nil idle 0])
  accept-process-output(#<process emacsql-sqlite> 30)
  #f(compiled-function (connection &optional timeout) "Block until CONNECTION is waiting for further input." #<bytecode 0x1ffbed32b0d9>)(#<forge-database forge-database-1ffbee23a43c>)
  apply(#f(compiled-function (connection &optional timeout) "Block until CONNECTION is waiting for further input." #<bytecode 0x1ffbed32b0d9>) #<forge-database forge-database-1ffbee23a43c> nil)
  emacsql-wait(#<forge-database forge-database-1ffbee23a43c>)
  #f(compiled-function (connection sql &rest args) "Send SQL s-expression to CONNECTION and return the results." #<bytecode 0x1ffbed32d8ed>)(#<forge-database forge-database-1ffbee23a43c> [:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.com" "ztlevi" "python-test2")
  apply(#f(compiled-function (connection sql &rest args) "Send SQL s-expression to CONNECTION and return the results." #<bytecode 0x1ffbed32d8ed>) (#<forge-database forge-database-1ffbee23a43c> [:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.com" "ztlevi" "python-test2"))
  #f(compiled-function (&rest cnm-args) #<bytecode 0x1ffbe0738bed>)(#<forge-database forge-database-1ffbee23a43c> [:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.com" "ztlevi" "python-test2")
  apply(#f(compiled-function (&rest cnm-args) #<bytecode 0x1ffbe0738bed>) #<forge-database forge-database-1ffbee23a43c> [:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] ("github.com" "ztlevi" "python-test2"))
  #f(compiled-function (connection sql &rest args) #<bytecode 0x1ffbee2caea1>)(#f(compiled-function (&rest cnm-args) #<bytecode 0x1ffbe0738bed>) #<forge-database forge-database-1ffbee23a43c> [:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.com" "ztlevi" "python-test2")
  apply(#f(compiled-function (connection sql &rest args) #<bytecode 0x1ffbee2caea1>) #f(compiled-function (&rest cnm-args) #<bytecode 0x1ffbe0738bed>) (#<forge-database forge-database-1ffbee23a43c> [:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.com" "ztlevi" "python-test2"))
  #f(compiled-function (&rest args) #<bytecode 0x1ffbeea0db81>)(#<forge-database forge-database-1ffbee23a43c> [:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.com" "ztlevi" "python-test2")
  apply(#f(compiled-function (&rest args) #<bytecode 0x1ffbeea0db81>) #<forge-database forge-database-1ffbee23a43c> ([:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.com" "ztlevi" "python-test2"))
  emacsql(#<forge-database forge-database-1ffbee23a43c> [:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.com" "ztlevi" "python-test2")
  apply(emacsql #<forge-database forge-database-1ffbee23a43c> [:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] ("github.com" "ztlevi" "python-test2"))
  forge-sql([:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.com" "ztlevi" "python-test2")
  #f(compiled-function (&rest rest) "((host owner name) &optional remote demand)\n\nReturn the repository identified by HOST, OWNER and NAME." #<bytecode 0x1ffbec4c96c5>)(("github.com" "ztlevi" "python-test2") "origin" full)
  apply(#f(compiled-function (&rest rest) "((host owner name) &optional remote demand)\n\nReturn the repository identified by HOST, OWNER and NAME." #<bytecode 0x1ffbec4c96c5>) ("github.com" "ztlevi" "python-test2") ("origin" full))
  forge-get-repository(("github.com" "ztlevi" "python-test2") "origin" full)
  #f(compiled-function (url &optional remote demand) "Return the repository at URL." #<bytecode 0x1ffbec4c9659>)("https://github.com/ztlevi/python-test2.git" "origin" full)
  apply(#f(compiled-function (url &optional remote demand) "Return the repository at URL." #<bytecode 0x1ffbec4c9659>) "https://github.com/ztlevi/python-test2.git" ("origin" full))
  forge-get-repository("https://github.com/ztlevi/python-test2.git" "origin" full)
  #f(compiled-function (demand &optional remote) "Return the current forge repository.\n\nIf the `forge-buffer-repository' is non-nil, then return that.\nOtherwise if `forge-buffer-topic' is non-nil, then return the\nrepository for that.  Finally if both variables are nil, then\nreturn the forge repository corresponding to the current Git\nrepository, if any." #<bytecode 0x1ffbec4c9641>)(full)
  apply(#f(compiled-function (demand &optional remote) "Return the current forge repository.\n\nIf the `forge-buffer-repository' is non-nil, then return that.\nOtherwise if `forge-buffer-topic' is non-nil, then return the\nrepository for that.  Finally if both variables are nil, then\nreturn the forge repository corresponding to the current Git\nrepository, if any." #<bytecode 0x1ffbec4c9641>) full nil)
  forge-get-repository(full)
  forge-bug-reference-setup()
  run-hooks(find-file-hook)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer test.py> "~/src/python-test2/test.py" nil nil "~/src/python-test2/test.py" (14531044 16777223))
  find-file-noselect("/Users/nd/src/python-test2/test.py")
  #f(compiled-function (files proc &optional nowait) "Find FILES and return a list of buffers created.\nFILES is an alist whose elements are (FILENAME . FILEPOS)\nwhere FILEPOS can be nil or a pair (LINENUMBER . COLUMNNUMBER).\nPROC is the client that requested this operation.\nNOWAIT non-nil means this client is not waiting for the results,\nso don't mark these buffers specially, just visit them normally." #<bytecode 0x1ffbe8c41019>)((("/Users/nd/src/python-test2/test.py")) #<process server <3>> t)
  apply(#f(compiled-function (files proc &optional nowait) "Find FILES and return a list of buffers created.\nFILES is an alist whose elements are (FILENAME . FILEPOS)\nwhere FILEPOS can be nil or a pair (LINENUMBER . COLUMNNUMBER).\nPROC is the client that requested this operation.\nNOWAIT non-nil means this client is not waiting for the results,\nso don't mark these buffers specially, just visit them normally." #<bytecode 0x1ffbe8c41019>) ((("/Users/nd/src/python-test2/test.py")) #<process server <3>> t))
  server-visit-files((("/Users/nd/src/python-test2/test.py")) #<process server <3>> t)
  server-execute(#<process server <3>> (("/Users/nd/src/python-test2/test.py")) t nil t nil nil)
  #f(compiled-function () #<bytecode 0x1ffbede94e61>)()
  server-execute-continuation(#<process server <3>>)
  server-process-filter(#<process server <3>> "-dir /Users/nd/src/python-test2/ -nowait -current-...")

A symbol-overlay-jump-avy function for the symbol-overlay-map

I haven't tested this a ton but it seems to work and seems useful. Perhaps there are better ways to implement it. I'm sure you don't want to add a dependency on avy, but if the user has it installed, I think it would be useful to bind this to symbol-overlay-map for them.

(defun symbol-overlay-jump-avy ()
  "Jump to another occurance of symbol with avy."
  (interactive)
  (avy-with symbol-overlay-jump-avy
    (avy-process 
     (avy--regex-candidates (regexp-quote (thing-at-point 'symbol t))))))
(define-key symbol-overlay-map (kbd "'") 'symbol-overlay-jump-avy)

[Request] highlight TODO

I am happy with symbol-overlay and hl-todo. But hl-todo uses font-lock while not overlay, so it is slow. Can you please integrate these functionalities into symbol-overlay? I think only highlight the keywords in comments for prog-mode, and all for text-mode. Thank you!

Request: add help-echo

Can we also add/edit overlay's help-echo property when highlight a symbol? This would be helpful when working on new code base.
Thanks

Support other search tools, like `swiper-isearch-thing-at-point`

When point is on an active/overlaid word, pressing s invokes symbol-overlay-isearch-literally (and that's not ideal for some of us). If you use ivy/swiper-isearch (or maybe helm) instead of isearch, you're stuck in an awkward isearch.

It'd be nicer if instead pressing s would invoke a configurable searcher.

[Feature Request] jump and help

Hi, I love this amazing package and I'm enjoying!

I have two requirements. Can you think about them?

  1. Jump to the first and the last. I have the implementation for it.
(defun symbol-overlay-switch-first ()
      (interactive)
      (let* ((symbol (symbol-overlay-get-symbol))
             (keyword (symbol-overlay-assoc symbol))
             (a-symbol (car keyword))
             (before (symbol-overlay-get-list a-symbol 'car))
             (count (length before)))
        (symbol-overlay-jump-call 'symbol-overlay-basic-jump (- count))))

(defun symbol-overlay-switch-last ()
      (interactive)
      (let* ((symbol (symbol-overlay-get-symbol))
             (keyword (symbol-overlay-assoc symbol))
             (a-symbol (car keyword))
             (after (symbol-overlay-get-list a-symbol 'cdr))
             (count (length after)))
        (symbol-overlay-jump-call 'symbol-overlay-basic-jump (- count 1))))

I bind to < and > in symbol-overlay-map.

I can make a PR if you agree.

  1. Show help for keybindings. Suggest to bind to h.

BTW: doom-modeline supports symbol-overlay. Refer to https://emacs-china.org/t/package-symbol-overlay-symbol/7706/18?u=seagle0128.

Request: Highlight current symbol?

I think the highlight-symbol is able to highlight the current symbol under point.

Would be great to have the same functionality for symbol-overlay!

Thanks.

Transient for symbol-overlay

For what it's worth, I've been very happily using this transient for symbol-overlay for a while. It could be bound to any key but I have a super- key configured and am binding this to s-. which I find nicely parallels M-..

(define-transient-command symbol-overlay-transient ()
  "Symbol Overlay transient"
  ["Symbol Overlay"
   ["Overlays"
    ("." "Add/Remove at point" symbol-overlay-put)
    ("k" "Remove All" symbol-overlay-remove-all)
    ]
   ["Move to Symbol"
    ("n" "Next" symbol-overlay-switch-forward)
    ("p" "Previous" symbol-overlay-switch-backward)
    ]
   ["Other"
    ("m" "Highlight symbol-at-point" symbol-overlay-mode)
    ]
   ]
  )
(global-set-key (kbd "s-.") 'symbol-overlay-transient)

blacklist symbols

hi, thanks for this package!

idea:

it would be nice if the automatic temporary overlays would support a blacklist, to avoid highlighting common symbols such as if and for in programming languages which basically cause the screen to flicker in most cases. :)

[Feature Request] Highlight current selection region as iedit did.

e.g. i only want to highlight the overlay part of the symbol symbol-overlay-put, so, i will set mark and highlight that region first, then run symbol-overlay-put, but, it still highlight entire symbol-overlay-put part.

image

Following is the same effect when use with iedit package, it works as expected.

image

thank you.

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.