[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8ec8a5b 05/14: Use cl-lib, nadvice, and lexical-binding
From: |
Phil |
Subject: |
[elpa] master 8ec8a5b 05/14: Use cl-lib, nadvice, and lexical-binding |
Date: |
Sat, 11 Jul 2020 00:57:55 -0400 (EDT) |
branch: master
commit 8ec8a5be830995d02d41186ffb9a5198a60fea2e
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Phil Sainty <psainty@orcon.net.nz>
Use cl-lib, nadvice, and lexical-binding
(delight--inhibit): Rename from inhibit-mode-name-delight to clean up
namespace use.
(delight--format-mode-line): New function, extracted from the old defadvice.
(format-mode-line): Replace defadvice with advice-add.
Co-authored-by: Phil Sainty <psainty@orcon.net.nz>
Based on GNU ELPA commit 463f1e3f14ed99dd35d77be8fa55055e5e7c71cb.
---
delight.el | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/delight.el b/delight.el
index e8265b6..9c6cba1 100644
--- a/delight.el
+++ b/delight.el
@@ -1,13 +1,14 @@
-;;; delight.el --- A dimmer switch for your lighter text.
+;;; delight.el --- A dimmer switch for your lighter text -*-
lexical-binding:t -*-
;;
-;; Copyright (C) 2013, 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
;; Author: Phil Sainty <psainty@orcon.net.nz>
;; Maintainer: Phil Sainty <psainty@orcon.net.nz>
;; URL: https://savannah.nongnu.org/projects/delight
+;; Package-Requires: ((cl-lib "0.5") (nadvice "0.3"))
;; Keywords: convenience
;; Created: 25 Jun 2013
-;; Version: 1.5
+;; Version: 1.6
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -92,6 +93,9 @@
;;; Change Log:
;;
+;; 1.6 (2019-07-23)
+;; - Use cl-lib, nadvice, and lexical-binding.
+;; - Rename `inhibit-mode-name-delight' to `delight--inhibit'.
;; 1.5 (2016-03-01)
;; - Support FILE value t, meaning that the minor MODE in question
;; is guaranteed to already be loaded.
@@ -109,8 +113,8 @@
;;; Code:
-(eval-when-compile
- (require 'cl))
+(eval-when-compile (require 'cl-lib))
+(require 'nadvice)
(defvar delighted-modes ()
"List of specs for modifying the display of mode names in the mode line.
@@ -142,10 +146,10 @@ for this purpose). These FILE options are relevant to
minor modes only.
For major modes you should specify the keyword :major as the value of FILE,
to prevent the mode being treated as a minor mode."
- (add-hook 'after-change-major-mode-hook 'delight-major-mode)
+ (add-hook 'after-change-major-mode-hook #'delight-major-mode)
(let ((glum (if (consp spec) spec (list (list spec value file)))))
(while glum
- (destructuring-bind (mode &optional value file) (pop glum)
+ (cl-destructuring-bind (mode &optional value file) (pop glum)
(assq-delete-all mode delighted-modes)
(add-to-list 'delighted-modes (list mode value file))
(unless (eq file :major)
@@ -201,19 +205,23 @@ When `mode-name' is displayed in other contexts (such as
in the
`describe-mode' help buffer), its original value will be used."
(let ((major-delight (assq major-mode delighted-modes)))
(when major-delight
- (setq mode-name `(inhibit-mode-name-delight
+ (setq mode-name `(delight--inhibit
,mode-name ;; glum
,(cadr major-delight)))))) ;; delighted
-(defvar inhibit-mode-name-delight)
+(define-obsolete-variable-alias 'inhibit-mode-name-delight
+ 'delight--inhibit "delight-1.6")
+(defvar delight--inhibit)
-(defadvice format-mode-line (around delighted-modes-are-glum activate)
+(defun delight--format-mode-line (orig-fun &rest args)
"Delighted modes should exhibit their original `mode-name' when
`format-mode-line' is called. See `delight-major-mode'."
- (let ((inhibit-mode-name-delight (if (boundp 'inhibit-mode-name-delight)
- inhibit-mode-name-delight
+ (let ((delight--inhibit (if (boundp 'delight--inhibit)
+ delight--inhibit
t)))
- ad-do-it))
+ (apply orig-fun args)))
+
+(advice-add 'format-mode-line :around #'delight--format-mode-line)
(provide 'delight)
;;; delight.el ends here
- [elpa] master updated (b8c9fbb -> 2a774d1), Phil, 2020/07/11
- [elpa] master 05ef4d7 03/14: Fix quote character in `delight' docstring in Emacs 25+, Phil, 2020/07/11
- [elpa] master d2cc2fc 02/14: Use GNU ELPA version number formatting, Phil, 2020/07/11
- [elpa] master e3bd4c2 01/14: * delight.el: Fix copyright, Phil, 2020/07/11
- [elpa] master 8ec8a5b 05/14: Use cl-lib, nadvice, and lexical-binding,
Phil <=
- [elpa] master 6d4a5aa 06/14: Use double-spaced sentence formatting, Phil, 2020/07/11
- [elpa] master 17cce66 04/14: Re-format the Change Log, Phil, 2020/07/11
- [elpa] master a763ec1 07/14: Rename `delight--inhibit' to `delight-mode-name-inhibit', Phil, 2020/07/11
- [elpa] master da63492 08/14: Rename `delighted-modes' to `delight-delighted-modes', Phil, 2020/07/11
- [elpa] master 088aae0 09/14: Support live updates from earlier versions, Phil, 2020/07/11
- [elpa] master 26dab6b 10/14: Support `unload-feature', Phil, 2020/07/11
- [elpa] master 989eed2 11/14: Add to after-change-major-mode-hook at load time, Phil, 2020/07/11
- [elpa] master 2a774d1 14/14: Merge commit '5a0cd5ccb650d7bba1c1ea02cf67b71d7cfa6e9a' from delight, Phil, 2020/07/11
- [elpa] master 5a0cd5c 12/14: Documentation, Phil, 2020/07/11
- [elpa] master a1b7e94 13/14: * externals-list: Use https for "delight" subtree URL, Phil, 2020/07/11