diff options
-rw-r--r-- | common.el | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -12,6 +12,31 @@ 32) str))))) +;;; A better face-remap-remove-relative + +(defun durand-face-remap-remove-relative (cookie) + "Remove a face remapping previously added by `face-remap-add-relative'. +COOKIE should be the return value from that function. + +Modified by Durand to use `equal' as the comparison function, so +that we are not required to record the objects returned +previously by `face-remap-add-relative', at 2021-06-05." + (let ((remapping (assq (car cookie) face-remapping-alist))) + (when remapping + (let ((updated-entries (remove (cdr cookie) (cdr remapping)))) + (unless (eq updated-entries (cdr remapping)) + (setcdr remapping updated-entries) + (when (or (null updated-entries) + (and (eq (car-safe updated-entries) (car cookie)) + (null (cdr updated-entries)))) + (setq face-remapping-alist + (remove remapping face-remapping-alist)) + ;; Force redisplay of this buffer. + (force-mode-line-update)) + (cdr cookie)))))) + +(advice-add 'face-remap-remove-relative :override 'durand-face-remap-remove-relative) + ;;; jump between the completions buffer and the minibuffer ;;;###autoload |