unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: help-gnu-emacs@gnu.org, larsi@gnu.org, 53771@debbugs.gnu.org
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	[thread overview]
Message-ID: <Yw/ODWnQPKWYceoU@protected.localdomain> (raw)
In-Reply-To: <871qsxnt57.fsf@web.de>

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/



      parent reply	other threads:[~2022-08-31 21:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 21:11 Why M-x highlight-regexp does not work after sort in tabulated-list-mode? Jean Louis
2022-08-31  0:39 ` Michael Heerdegen
2022-08-31  4:03   ` Jean Louis
2022-08-31  4:19   ` Jean Louis
2022-08-31  4:29     ` Jean Louis
2022-09-02  0:11     ` bug#53771: " Michael Heerdegen
2022-08-31 21:09   ` Jean Louis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yw/ODWnQPKWYceoU@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=53771@debbugs.gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=larsi@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).