alphapapa / topsy.el

Simple sticky header showing definition beyond top of window
GNU General Public License v3.0
100 stars 6 forks source link

Docs: Suggest alternative topsy function my/topsy-elisp-header-line #13

Open josephmturner opened 1 year ago

josephmturner commented 1 year ago

Uses the header line as an extra line of buffer text when the window-start isn't inside a list.

The cl-pushnew block assumes that #10 has been merged first. If we don't merge #10, we can change it to:

(cl-pushnew '(emacs-lisp-mode . my/topsy-lisp-header-line) topsy-mode-functions)
alphapapa commented 1 year ago

Now that I've improved the magit-section-mode function, I'd like to find a way to implement this functionality in a "mode-agnostic" way, so users could simply select to use this option or not, and it would work regardless of the major mode and related function. What do you think?

josephmturner commented 1 year ago

I just tested my/topsy-lisp-header-line with markdown-mode and js-ts-mode, and it didn't give desired results. However, I also tested topsy--beginning-of-defun, and it doesn't work well with js-ts-mode either (and least with js objects).

The behavior of backward-up-list does seem to be inconsistent among major modes. What other approach would be more mode-agnostic?

roshanshariff commented 10 months ago

18 implements this functionality in a mode-agnostic way, controlled by a new defcustom. Maybe that'll meet your needs?