emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obsolescence warnings


From: Thien-Thi Nguyen
Subject: Re: Obsolescence warnings
Date: Wed, 11 Jan 2017 15:25:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

() Stefan Monnier <address@hidden>
() Sat, 24 Dec 2016 00:02:03 -0500

   To the extent that it affects the end-user and is caught
   during execution, this mechanism needs to be very careful not
   to get in the way, although it should be visible enough that
   we can reasonably expect that the user will likely see those
   messages.

Here's an idea:

(defun message-with-properties (plist fmt &rest args)
  "Like ‘message’ for FMT and ARGS, and also propertize w/ PLIST.
Return the propertized, formatted string."
  (with-current-buffer (get-buffer "*Messages*")
    (let* ((beg (goto-char (point-max)))
           (str (apply #'message fmt args))
           (end (+ beg (length str) 1))
           (inhibit-read-only t))
      (add-text-properties beg end plist)
      (buffer-substring beg end))))

(message-with-properties
 '(face font-lock-warning-face)
 "obsolete: %S" 'obsolete-thing)

We can then tell people to look for easily visible "obsolete" in
*Messages*, and they can do that at their own convenience, or we
can programmatically collect such blurbs for a more concentrated
presentation, later.  In the meantime, this can be tweaked a bit
for other (ab)uses, such as ‘C-u C-h e’ doing filtering based on
various properties, etc.  WDYT?

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical mailing-list) t)
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]