all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: Obsolescence warnings
Date: Wed, 11 Jan 2017 15:25:06 +0100	[thread overview]
Message-ID: <87h955r7wd.fsf@zigzag.favinet> (raw)
In-Reply-To: <jwv1swydj50.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Sat, 24 Dec 2016 00:02:03 -0500")

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]


() Stefan Monnier <monnier@iro.umontreal.ca>
() 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2017-01-11 14:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161224023808.12868.71069@vcs.savannah.gnu.org>
     [not found] ` <20161224023808.9EE8D2201BC@vcs.savannah.gnu.org>
2016-12-24  5:02   ` Obsolescence warnings (was: [Emacs-diffs] master 9227b5c: last-chance: new utility lib for dangling deterrence) Stefan Monnier
2017-01-11 14:25     ` Thien-Thi Nguyen [this message]
2017-01-11 14:33       ` Obsolescence warnings Stefan Monnier

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

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

  git send-email \
    --in-reply-to=87h955r7wd.fsf@zigzag.favinet \
    --to=ttn@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.