* Obsolescence warnings (was: [Emacs-diffs] master 9227b5c: last-chance: new utility lib for dangling deterrence) [not found] ` <20161224023808.9EE8D2201BC@vcs.savannah.gnu.org> @ 2016-12-24 5:02 ` Stefan Monnier 2017-01-11 14:25 ` Obsolescence warnings Thien-Thi Nguyen 0 siblings, 1 reply; 3+ messages in thread From: Stefan Monnier @ 2016-12-24 5:02 UTC (permalink / raw) To: emacs-devel; +Cc: Thien-Thi Nguyen > +;; [Insert "nobody reads ChangeLog files" lament, here. --ttn] I think the problem is older, since it was made obsolete a long time ago. IOW, the problem really is that there's no warning ever given when we use an obsolete face. In general, I think we're currently not proactive enough in warning about uses of obsolete thingies: for functions and variables, we handle that during byte-compilation, so those are mostly covered, but not so for: - faces (as evidenced here). - user-variables or hooks (since the users most likely don't byte-compile their ~/.emacs file). - more generally code that isn't byte-compiled (it's very common for users to use Elisp code without ever byte-compiling it). - text-properties. - I'm sure there are more cases. I think it would be good to introduce a mechanism to tell the user about uses of obsolete features. And by "user" here I mean "end user", not because I prefer warning the end-user than the developer, but because in many of those cases they're one and the same, and because in other cases that's the best we can do. 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. Stefan ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Obsolescence warnings 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 2017-01-11 14:33 ` Stefan Monnier 0 siblings, 1 reply; 3+ messages in thread From: Thien-Thi Nguyen @ 2017-01-11 14:25 UTC (permalink / raw) To: emacs-devel [-- 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 --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Obsolescence warnings 2017-01-11 14:25 ` Obsolescence warnings Thien-Thi Nguyen @ 2017-01-11 14:33 ` Stefan Monnier 0 siblings, 0 replies; 3+ messages in thread From: Stefan Monnier @ 2017-01-11 14:33 UTC (permalink / raw) To: emacs-devel > (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. I think this is the easy part. The harder parts are: - perform the obsolescence checks (we don't do that currently for faces, and we don't do it for (setq <obsolete-var> <val>) in the user's ~/.emacs either). - perform those checks efficiently. - display them in an effective and friendly way. For the last part, for example, I use locally (advice-add obsolete-name :before (lambda (&rest _) (message "Warning: %s is obsolete!" obsolete-name)) '((name . obsolescence-warning))) in `make-obsolete`. It kinda works. But for some obsolete functions, it leads occasionally to a deluge of messages which can be not just annoying but can also hide the useful info. So it's not friendly. In other cases, the obsolescence message is actually never shown because it's immediately replaced with another message. Another problem with it is that it doesn't tell me where that obsoleted function was called, so I then have to chase down the source: you can't expect an end user to do that, so his bug-report will often be rather useless. So it's not really effective either. I guess we could live with something like that where we only activate it in the master branch (i.e. version numbers of the form NN.50.OO), but even then people will get annoyed and will want to turn it off. Stefan ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-11 14:33 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [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 ` Obsolescence warnings Thien-Thi Nguyen 2017-01-11 14:33 ` Stefan Monnier
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).