[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why M-x highlight-regexp does not work after sort in tabulated-list-
From: |
Jean Louis |
Subject: |
Re: Why M-x highlight-regexp does not work after sort in tabulated-list-mode? |
Date: |
Thu, 1 Sep 2022 00:09:33 +0300 |
User-agent: |
Mutt/+ () (2022-06-11) |
Here is how I solve it:
(defun rcd-highlight-list (list)
"Highlight LIST of regular expressions in buffer."
(hi-lock-mode)
(let* ((list (delete "" list))
(highlights hi-lock-face-defaults))
(while list
(highlight-regexp (regexp-quote (pop list)) (pop highlights)))))
;; In the following function I am removing values from these two
variables as highlighting does not work otherwise. I consider that
rather a bug.
(defun hyperscope-highlight (&optional highlight-list)
(setq hi-lock-interactive-patterns nil)
(setq hi-lock-interactive-lighters nil)
(let* ((list (hyperscope-action-status-name-list))
(list (append list '("SUCCESS" "DISEASE" "FOLLOW-UP")))
(list (append list highlight-list)))
(rcd-highlight-list list)))
Then I advice tabulated list mode functions.
;;; Advice functions
(defun hyperscope-after-sort (&rest args)
(hyperscope-highlight))
(advice-add 'tabulated-list-col-sort :after 'hyperscope-after-sort)
(advice-add 'tabulated-list-sort :after 'hyperscope-after-sort)
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/