* bug#45946: 28.0.50; hl-line-sticky-flag not working @ 2021-01-18 4:13 Gabriel do Nascimento Ribeiro 2021-01-21 1:07 ` bug#45946: [PATCH] " Gabriel do Nascimento Ribeiro 0 siblings, 1 reply; 7+ messages in thread From: Gabriel do Nascimento Ribeiro @ 2021-01-18 4:13 UTC (permalink / raw) To: 45946 1) emacs -q # start emacs 2) C-x 3 # split window right 3) C-x <left> # go to previous buffer (*scratch*) 4) eval the following expression: (setq-default hl-line-sticky-flag nil) 5) M-x hl-line-mode # enable hl-line-mode in current buffer 6) C-x o # other window (*GNU Emacs*) 7) M-x hl-line-mode # enable hl-line-mode in current buffer 8) C-x o multiple times to change the selected window Expected result: the line is highlighted only in selected window Actual result: sometimes the line in non-selected window is not unhighlighted --- In GNU Emacs 28.0.50 (build 39, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0) of 2021-01-16 built on precision5540 Repository revision: 25e1b732947bcba51e457a7168eba6608fb666c0 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12009000 System Description: Ubuntu 20.10 Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LCMS2 LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB Important settings: value of $LC_CTYPE: pt_BR.UTF-8 value of $LC_MONETARY: pt_BR.UTF-8 value of $LC_NUMERIC: pt_BR.UTF-8 value of $LC_TIME: pt_BR.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort emacsbug mail-extr cursor-sensor nndraft nnmh utf-7 gnutls network-stream nsm nnnil gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg nntp gnus-cache smtpmail sendmail misearch multi-isearch rx org-element avl-tree generator ol-eww eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search eieio-opt speedbar ezimage dframe gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku svg dom browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse url-vars mailcap gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message rmc puny rfc822 mml mml-sec epa derived epg epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map rfc2047 rfc2045 ietf-drums mail-utils mm-util mail-prsvr wid-edit ol-docview doc-view image-mode exif dired dired-loaddefs ol-bibtex bibtex iso8601 ol-bbdb ol-w3m org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color ring org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat advice org-macs org-loaddefs format-spec cal-menu calendar cal-loaddefs vc-git diff-mode easy-mmode conf-mode dabbrev jka-compr find-func cl-print time-date subr-x cl-extra shortdoc text-property-search seq byte-opt gv bytecomp byte-compile cconv hl-line thingatpt help-fns radix-tree help-mode easymenu cl-loaddefs cl-lib iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 216767 12349) (symbols 48 22643 1) (strings 32 76291 2945) (string-bytes 1 2499291) (vectors 16 35895) (vector-slots 8 445907 18792) (floats 8 315 136) (intervals 56 1217 0) (buffers 984 24)) ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#45946: [PATCH] Re: bug#45946: 28.0.50; hl-line-sticky-flag not working 2021-01-18 4:13 bug#45946: 28.0.50; hl-line-sticky-flag not working Gabriel do Nascimento Ribeiro @ 2021-01-21 1:07 ` Gabriel do Nascimento Ribeiro 2021-01-21 14:13 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Gabriel do Nascimento Ribeiro @ 2021-01-21 1:07 UTC (permalink / raw) To: 45946 [-- Attachment #1: Type: text/plain, Size: 157 bytes --] Here is a proposal of patch for this bug. It seems to work well in all cases I have tested, but maybe I am missing some edge case. Suggestions are welcome. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-Always-set-overlay-current-buffer-on-hl-line-maybe-u.patch --] [-- Type: text/x-diff, Size: 855 bytes --] From f4586cd7f535a9613216f61888a5ab8ee05352ca Mon Sep 17 00:00:00 2001 From: Gabriel do Nascimento Ribeiro <gabriel.nascimento@nubank.com.br> Date: Wed, 20 Jan 2021 22:02:31 -0300 Subject: [PATCH] Always set overlay current-buffer on hl-line-maybe-unhighlight --- lisp/hl-line.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/hl-line.el b/lisp/hl-line.el index 73870f9579..b19b9543f5 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el @@ -193,8 +193,7 @@ hl-line-maybe-unhighlight (with-current-buffer hlob (when (overlayp hl-line-overlay) (delete-overlay hl-line-overlay)))) - (when (and (overlayp hl-line-overlay) - (eq (overlay-buffer hl-line-overlay) curbuf)) + (when (overlayp hl-line-overlay) (setq hl-line-overlay-buffer curbuf)))) ;;;###autoload -- 2.27.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#45946: [PATCH] Re: bug#45946: 28.0.50; hl-line-sticky-flag not working 2021-01-21 1:07 ` bug#45946: [PATCH] " Gabriel do Nascimento Ribeiro @ 2021-01-21 14:13 ` Eli Zaretskii 2021-01-23 2:22 ` Gabriel do Nascimento Ribeiro 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2021-01-21 14:13 UTC (permalink / raw) To: Gabriel do Nascimento Ribeiro; +Cc: 45946 > From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com> > Date: Wed, 20 Jan 2021 22:07:33 -0300 > > Here is a proposal of patch for this bug. It seems to work well in all > cases I have tested, but maybe I am missing some edge case. Suggestions > are welcome. Thanks. While at that, would it be possible to fix some code there that I at least consider strange? E.g., it calls delete-overlay, but doesn't assign nil to the variable, so the overlayp predicate still returns non-nil for the resulting invalid overlay. Also, it puts 2 functions on the post-command-hook, but it looks like the code subtly depends on the order of their execution (should hl-line-highlight run before or after hl-line-maybe-unhighlight?). ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#45946: [PATCH] Re: bug#45946: 28.0.50; hl-line-sticky-flag not working 2021-01-21 14:13 ` Eli Zaretskii @ 2021-01-23 2:22 ` Gabriel do Nascimento Ribeiro 2021-01-23 8:10 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Gabriel do Nascimento Ribeiro @ 2021-01-23 2:22 UTC (permalink / raw) To: 45946 [-- Attachment #1: Type: text/plain, Size: 968 bytes --] Eli Zaretskii <eliz@gnu.org> writes: >> From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com> >> Date: Wed, 20 Jan 2021 22:07:33 -0300 >> >> Here is a proposal of patch for this bug. It seems to work well in all >> cases I have tested, but maybe I am missing some edge case. Suggestions >> are welcome. > > Thanks. > > While at that, would it be possible to fix some code there that I at > least consider strange? E.g., it calls delete-overlay, but doesn't > assign nil to the variable, so the overlayp predicate still returns > non-nil for the resulting invalid overlay. Also, it puts 2 functions > on the post-command-hook, but it looks like the code subtly depends on > the order of their execution (should hl-line-highlight run before or > after hl-line-maybe-unhighlight?). Hi Eli, Thanks for your suggestions. Please find attached a new patch that uses a single post-command-hook function and some other minor changes. The original issue is fixed. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-Use-single-post-command-hook-on-hl-line.patch --] [-- Type: text/x-diff, Size: 7133 bytes --] From 980504403e41164fef79806781eff84e05760463 Mon Sep 17 00:00:00 2001 From: Gabriel do Nascimento Ribeiro <gabriel.nascimento@nubank.com.br> Date: Fri, 22 Jan 2021 23:05:17 -0300 Subject: [PATCH] Use single post-command-hook on hl-line --- lisp/hl-line.el | 58 +++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/lisp/hl-line.el b/lisp/hl-line.el index 73870f9579..82952e934b 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el @@ -45,11 +45,7 @@ ;; An overlay is used. In the non-sticky cases, this overlay is ;; active only on the selected window. A hook is added to ;; `post-command-hook' to activate the overlay and move it to the line -;; about point. To get the non-sticky behavior, `hl-line-unhighlight' -;; is added to `pre-command-hook' as well. This function deactivates -;; the overlay unconditionally in case the command changes the -;; selected window. (It does so rather than keeping track of changes -;; in the selected window). +;; about point. ;; You could make variable `global-hl-line-mode' buffer-local and set ;; it to nil to avoid highlighting specific buffers, when the global @@ -91,9 +87,9 @@ hl-line-face (set symbol value) (dolist (buffer (buffer-list)) (with-current-buffer buffer - (when hl-line-overlay + (when (overlayp hl-line-overlay) (overlay-put hl-line-overlay 'face hl-line-face)))) - (when global-hl-line-overlay + (when (overlayp global-hl-line-overlay) (overlay-put global-hl-line-overlay 'face hl-line-face)))) (defcustom hl-line-sticky-flag t @@ -141,9 +137,7 @@ hl-line-mode `hl-line-highlight' on `post-command-hook' in this case. When `hl-line-sticky-flag' is nil, Hl-Line mode highlights the -line about point in the selected window only. In this case, it -uses the function `hl-line-maybe-unhighlight' in -addition to `hl-line-highlight' on `post-command-hook'." +line about point in the selected window only." :group 'hl-line (if hl-line-mode (progn @@ -151,12 +145,10 @@ hl-line-mode (add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t) (hl-line-highlight) (setq hl-line-overlay-buffer (current-buffer)) - (add-hook 'post-command-hook #'hl-line-highlight nil t) - (add-hook 'post-command-hook #'hl-line-maybe-unhighlight nil t)) + (add-hook 'post-command-hook #'hl-line-highlight nil t)) (remove-hook 'post-command-hook #'hl-line-highlight t) (hl-line-unhighlight) - (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) - (remove-hook 'post-command-hook #'hl-line-maybe-unhighlight t))) + (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t))) (defun hl-line-make-overlay () (let ((ol (make-overlay (point) (point)))) @@ -168,17 +160,19 @@ hl-line-highlight "Activate the Hl-Line overlay on the current line." (if hl-line-mode ; Might be changed outside the mode function. (progn - (unless hl-line-overlay + (unless (overlayp hl-line-overlay) (setq hl-line-overlay (hl-line-make-overlay))) ; To be moved. (overlay-put hl-line-overlay 'window (unless hl-line-sticky-flag (selected-window))) - (hl-line-move hl-line-overlay)) + (hl-line-move hl-line-overlay) + (hl-line-maybe-unhighlight)) (hl-line-unhighlight))) (defun hl-line-unhighlight () "Deactivate the Hl-Line overlay on the current line." - (when hl-line-overlay - (delete-overlay hl-line-overlay))) + (when (overlayp hl-line-overlay) + (delete-overlay hl-line-overlay) + (setq hl-line-overlay nil))) (defun hl-line-maybe-unhighlight () "Maybe deactivate the Hl-Line overlay on the current line. @@ -191,8 +185,7 @@ hl-line-maybe-unhighlight (not (eq curbuf hlob)) (not (minibufferp))) (with-current-buffer hlob - (when (overlayp hl-line-overlay) - (delete-overlay hl-line-overlay)))) + (hl-line-unhighlight))) (when (and (overlayp hl-line-overlay) (eq (overlay-buffer hl-line-overlay) curbuf)) (setq hl-line-overlay-buffer curbuf)))) @@ -205,8 +198,8 @@ global-hl-line-mode highlights the line about the current buffer's point in all live windows. -Global-Hl-Line mode uses the functions `global-hl-line-highlight' -and `global-hl-line-maybe-unhighlight' on `post-command-hook'." +Global-Hl-Line mode uses the function `global-hl-line-highlight' +on `post-command-hook'." :global t :group 'hl-line (if global-hl-line-mode @@ -214,25 +207,24 @@ global-hl-line-mode ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'global-hl-line-unhighlight) (global-hl-line-highlight-all) - (add-hook 'post-command-hook #'global-hl-line-highlight) - (add-hook 'post-command-hook #'global-hl-line-maybe-unhighlight)) + (add-hook 'post-command-hook #'global-hl-line-highlight)) (global-hl-line-unhighlight-all) (remove-hook 'post-command-hook #'global-hl-line-highlight) - (remove-hook 'change-major-mode-hook #'global-hl-line-unhighlight) - (remove-hook 'post-command-hook #'global-hl-line-maybe-unhighlight))) + (remove-hook 'change-major-mode-hook #'global-hl-line-unhighlight))) (defun global-hl-line-highlight () "Highlight the current line in the current window." (when global-hl-line-mode ; Might be changed outside the mode function. (unless (window-minibuffer-p) - (unless global-hl-line-overlay + (unless (overlayp global-hl-line-overlay) (setq global-hl-line-overlay (hl-line-make-overlay))) ; To be moved. (unless (member global-hl-line-overlay global-hl-line-overlays) (push global-hl-line-overlay global-hl-line-overlays)) (overlay-put global-hl-line-overlay 'window (unless global-hl-line-sticky-flag (selected-window))) - (hl-line-move global-hl-line-overlay)))) + (hl-line-move global-hl-line-overlay) + (global-hl-line-maybe-unhighlight)))) (defun global-hl-line-highlight-all () "Highlight the current line in all live windows." @@ -243,8 +235,9 @@ global-hl-line-highlight-all (defun global-hl-line-unhighlight () "Deactivate the Global-Hl-Line overlay on the current line." - (when global-hl-line-overlay - (delete-overlay global-hl-line-overlay))) + (when (overlayp global-hl-line-overlay) + (delete-overlay global-hl-line-overlay) + (setq global-hl-line-overlay nil))) (defun global-hl-line-maybe-unhighlight () "Maybe deactivate the Global-Hl-Line overlay on the current line. @@ -256,9 +249,8 @@ global-hl-line-maybe-unhighlight (bufferp ovb) (not (eq ovb (current-buffer))) (not (minibufferp))) - (with-current-buffer ovb - (when (overlayp global-hl-line-overlay) - (delete-overlay global-hl-line-overlay)))))) + (with-current-buffer ovb + (global-hl-line-unhighlight))))) global-hl-line-overlays)) (defun global-hl-line-unhighlight-all () -- 2.27.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#45946: [PATCH] Re: bug#45946: 28.0.50; hl-line-sticky-flag not working 2021-01-23 2:22 ` Gabriel do Nascimento Ribeiro @ 2021-01-23 8:10 ` Eli Zaretskii 2021-01-23 19:11 ` Gabriel do Nascimento Ribeiro 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2021-01-23 8:10 UTC (permalink / raw) To: Gabriel do Nascimento Ribeiro; +Cc: 45946 > From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com> > Date: Fri, 22 Jan 2021 23:22:21 -0300 > > > While at that, would it be possible to fix some code there that I at > > least consider strange? E.g., it calls delete-overlay, but doesn't > > assign nil to the variable, so the overlayp predicate still returns > > non-nil for the resulting invalid overlay. Also, it puts 2 functions > > on the post-command-hook, but it looks like the code subtly depends on > > the order of their execution (should hl-line-highlight run before or > > after hl-line-maybe-unhighlight?). > > Hi Eli, > > Thanks for your suggestions. Please find attached a new patch that uses > a single post-command-hook function and some other minor changes. The > original issue is fixed. Thanks, this LGTM, but could you please accompany the changes with the ChangeLog-style commit log message (see CONTRIBUTE about the details)? Also, this patch is close to the limit that we can accept without copyright assignment. So I'd suggest that you start the legal paperwork rolling at this time, to allow us to accept your future contributions. Would you like me to send to you the legal form to fill? ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#45946: [PATCH] Re: bug#45946: 28.0.50; hl-line-sticky-flag not working 2021-01-23 8:10 ` Eli Zaretskii @ 2021-01-23 19:11 ` Gabriel do Nascimento Ribeiro 2021-01-23 19:37 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Gabriel do Nascimento Ribeiro @ 2021-01-23 19:11 UTC (permalink / raw) To: 45946 [-- Attachment #1: Type: text/plain, Size: 555 bytes --] > > Thanks, this LGTM, but could you please accompany the changes with the > ChangeLog-style commit log message (see CONTRIBUTE about the details)? > > Also, this patch is close to the limit that we can accept without > copyright assignment. So I'd suggest that you start the legal > paperwork rolling at this time, to allow us to accept your future > contributions. Would you like me to send to you the legal form to > fill? Patch updated with appropriate ChangeLog-style commit log message. I have already concluded the assignment process with FSF. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-Use-single-post-command-hook-on-hl-line-modes.patch --] [-- Type: text/x-diff, Size: 7378 bytes --] From c0293a572df799eb5cd03dd404c7fc364b6831d0 Mon Sep 17 00:00:00 2001 From: Gabriel do Nascimento Ribeiro <gabriel.nascimento@nubank.com.br> Date: Sat, 23 Jan 2021 15:38:42 -0300 Subject: [PATCH] Use single post-command-hook on hl-line modes * lisp/hl-line.el (hl-line-mode, global-hl-line-mode): Ensure that maybe-unhighlight is called after line is highlighted (bug#45946). (hl-line-unhighlight, global-hl-line-unhighlight): Set overlay variable to nil after overlay is deleted. --- lisp/hl-line.el | 58 +++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/lisp/hl-line.el b/lisp/hl-line.el index 73870f9579..82952e934b 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el @@ -45,11 +45,7 @@ ;; An overlay is used. In the non-sticky cases, this overlay is ;; active only on the selected window. A hook is added to ;; `post-command-hook' to activate the overlay and move it to the line -;; about point. To get the non-sticky behavior, `hl-line-unhighlight' -;; is added to `pre-command-hook' as well. This function deactivates -;; the overlay unconditionally in case the command changes the -;; selected window. (It does so rather than keeping track of changes -;; in the selected window). +;; about point. ;; You could make variable `global-hl-line-mode' buffer-local and set ;; it to nil to avoid highlighting specific buffers, when the global @@ -91,9 +87,9 @@ hl-line-face (set symbol value) (dolist (buffer (buffer-list)) (with-current-buffer buffer - (when hl-line-overlay + (when (overlayp hl-line-overlay) (overlay-put hl-line-overlay 'face hl-line-face)))) - (when global-hl-line-overlay + (when (overlayp global-hl-line-overlay) (overlay-put global-hl-line-overlay 'face hl-line-face)))) (defcustom hl-line-sticky-flag t @@ -141,9 +137,7 @@ hl-line-mode `hl-line-highlight' on `post-command-hook' in this case. When `hl-line-sticky-flag' is nil, Hl-Line mode highlights the -line about point in the selected window only. In this case, it -uses the function `hl-line-maybe-unhighlight' in -addition to `hl-line-highlight' on `post-command-hook'." +line about point in the selected window only." :group 'hl-line (if hl-line-mode (progn @@ -151,12 +145,10 @@ hl-line-mode (add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t) (hl-line-highlight) (setq hl-line-overlay-buffer (current-buffer)) - (add-hook 'post-command-hook #'hl-line-highlight nil t) - (add-hook 'post-command-hook #'hl-line-maybe-unhighlight nil t)) + (add-hook 'post-command-hook #'hl-line-highlight nil t)) (remove-hook 'post-command-hook #'hl-line-highlight t) (hl-line-unhighlight) - (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) - (remove-hook 'post-command-hook #'hl-line-maybe-unhighlight t))) + (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t))) (defun hl-line-make-overlay () (let ((ol (make-overlay (point) (point)))) @@ -168,17 +160,19 @@ hl-line-highlight "Activate the Hl-Line overlay on the current line." (if hl-line-mode ; Might be changed outside the mode function. (progn - (unless hl-line-overlay + (unless (overlayp hl-line-overlay) (setq hl-line-overlay (hl-line-make-overlay))) ; To be moved. (overlay-put hl-line-overlay 'window (unless hl-line-sticky-flag (selected-window))) - (hl-line-move hl-line-overlay)) + (hl-line-move hl-line-overlay) + (hl-line-maybe-unhighlight)) (hl-line-unhighlight))) (defun hl-line-unhighlight () "Deactivate the Hl-Line overlay on the current line." - (when hl-line-overlay - (delete-overlay hl-line-overlay))) + (when (overlayp hl-line-overlay) + (delete-overlay hl-line-overlay) + (setq hl-line-overlay nil))) (defun hl-line-maybe-unhighlight () "Maybe deactivate the Hl-Line overlay on the current line. @@ -191,8 +185,7 @@ hl-line-maybe-unhighlight (not (eq curbuf hlob)) (not (minibufferp))) (with-current-buffer hlob - (when (overlayp hl-line-overlay) - (delete-overlay hl-line-overlay)))) + (hl-line-unhighlight))) (when (and (overlayp hl-line-overlay) (eq (overlay-buffer hl-line-overlay) curbuf)) (setq hl-line-overlay-buffer curbuf)))) @@ -205,8 +198,8 @@ global-hl-line-mode highlights the line about the current buffer's point in all live windows. -Global-Hl-Line mode uses the functions `global-hl-line-highlight' -and `global-hl-line-maybe-unhighlight' on `post-command-hook'." +Global-Hl-Line mode uses the function `global-hl-line-highlight' +on `post-command-hook'." :global t :group 'hl-line (if global-hl-line-mode @@ -214,25 +207,24 @@ global-hl-line-mode ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'global-hl-line-unhighlight) (global-hl-line-highlight-all) - (add-hook 'post-command-hook #'global-hl-line-highlight) - (add-hook 'post-command-hook #'global-hl-line-maybe-unhighlight)) + (add-hook 'post-command-hook #'global-hl-line-highlight)) (global-hl-line-unhighlight-all) (remove-hook 'post-command-hook #'global-hl-line-highlight) - (remove-hook 'change-major-mode-hook #'global-hl-line-unhighlight) - (remove-hook 'post-command-hook #'global-hl-line-maybe-unhighlight))) + (remove-hook 'change-major-mode-hook #'global-hl-line-unhighlight))) (defun global-hl-line-highlight () "Highlight the current line in the current window." (when global-hl-line-mode ; Might be changed outside the mode function. (unless (window-minibuffer-p) - (unless global-hl-line-overlay + (unless (overlayp global-hl-line-overlay) (setq global-hl-line-overlay (hl-line-make-overlay))) ; To be moved. (unless (member global-hl-line-overlay global-hl-line-overlays) (push global-hl-line-overlay global-hl-line-overlays)) (overlay-put global-hl-line-overlay 'window (unless global-hl-line-sticky-flag (selected-window))) - (hl-line-move global-hl-line-overlay)))) + (hl-line-move global-hl-line-overlay) + (global-hl-line-maybe-unhighlight)))) (defun global-hl-line-highlight-all () "Highlight the current line in all live windows." @@ -243,8 +235,9 @@ global-hl-line-highlight-all (defun global-hl-line-unhighlight () "Deactivate the Global-Hl-Line overlay on the current line." - (when global-hl-line-overlay - (delete-overlay global-hl-line-overlay))) + (when (overlayp global-hl-line-overlay) + (delete-overlay global-hl-line-overlay) + (setq global-hl-line-overlay nil))) (defun global-hl-line-maybe-unhighlight () "Maybe deactivate the Global-Hl-Line overlay on the current line. @@ -256,9 +249,8 @@ global-hl-line-maybe-unhighlight (bufferp ovb) (not (eq ovb (current-buffer))) (not (minibufferp))) - (with-current-buffer ovb - (when (overlayp global-hl-line-overlay) - (delete-overlay global-hl-line-overlay)))))) + (with-current-buffer ovb + (global-hl-line-unhighlight))))) global-hl-line-overlays)) (defun global-hl-line-unhighlight-all () -- 2.27.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#45946: [PATCH] Re: bug#45946: 28.0.50; hl-line-sticky-flag not working 2021-01-23 19:11 ` Gabriel do Nascimento Ribeiro @ 2021-01-23 19:37 ` Eli Zaretskii 0 siblings, 0 replies; 7+ messages in thread From: Eli Zaretskii @ 2021-01-23 19:37 UTC (permalink / raw) To: Gabriel do Nascimento Ribeiro; +Cc: 45946-done > From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com> > Date: Sat, 23 Jan 2021 16:11:04 -0300 > > Patch updated with appropriate ChangeLog-style commit log message. Thanks, pushed (after minor tweaking of the log message). > I have already concluded the assignment process with FSF. Right, the records were updated today. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-01-23 19:37 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-18 4:13 bug#45946: 28.0.50; hl-line-sticky-flag not working Gabriel do Nascimento Ribeiro 2021-01-21 1:07 ` bug#45946: [PATCH] " Gabriel do Nascimento Ribeiro 2021-01-21 14:13 ` Eli Zaretskii 2021-01-23 2:22 ` Gabriel do Nascimento Ribeiro 2021-01-23 8:10 ` Eli Zaretskii 2021-01-23 19:11 ` Gabriel do Nascimento Ribeiro 2021-01-23 19:37 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).