update packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; treemacs.el --- A tree style file viewer package -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2020 Alexander Miller
|
||||
;; Copyright (C) 2021 Alexander Miller
|
||||
|
||||
;; 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
|
||||
@@ -20,10 +20,26 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'treemacs-customization)
|
||||
|
||||
(defvar treemacs--saved-eldoc-display nil
|
||||
"Stores the value of `treemacs-eldoc-display'.
|
||||
The value is set to nil and stashed here with every log statement to prevent the
|
||||
logged message being almost immediately overridden by the eldoc output.
|
||||
|
||||
The value is also stashed as a single-item-list which serves as a check make
|
||||
sure it isn't stashed twice (thus stashing the already disabled nil value).")
|
||||
|
||||
(defvar treemacs--no-messages nil
|
||||
"When set to t `treemacs-log' will produce no output.
|
||||
Not used directly, but as part of `treemacs-without-messages'.")
|
||||
|
||||
(defun treemacs--restore-eldoc-after-log ()
|
||||
"Restore the stashed value of `treemacs-eldoc-display'."
|
||||
(remove-hook 'pre-command-hook #'treemacs--restore-eldoc-after-log)
|
||||
(setf treemacs-eldoc-display (car treemacs--saved-eldoc-display)
|
||||
treemacs--saved-eldoc-display nil))
|
||||
|
||||
(defmacro treemacs-without-messages (&rest body)
|
||||
"Temporarily turn off messages to execute BODY."
|
||||
(declare (debug t))
|
||||
@@ -32,8 +48,13 @@ Not used directly, but as part of `treemacs-without-messages'.")
|
||||
|
||||
(defmacro treemacs--do-log (prefix msg &rest args)
|
||||
"Print a log statement with the given PREFIX and MSG and format ARGS."
|
||||
`(unless treemacs--no-messages
|
||||
(message "%s %s" ,prefix (format ,msg ,@args))))
|
||||
`(progn
|
||||
(unless (listp treemacs--saved-eldoc-display)
|
||||
(setf treemacs--saved-eldoc-display (list treemacs-eldoc-display)))
|
||||
(setf treemacs-eldoc-display nil)
|
||||
(unless treemacs--no-messages
|
||||
(message "%s %s" ,prefix (format ,msg ,@args)))
|
||||
(add-hook 'post-command-hook #'treemacs--restore-eldoc-after-log)))
|
||||
|
||||
(defmacro treemacs-log (msg &rest args)
|
||||
"Write an info/success log statement given format string MSG and ARGS."
|
||||
|
||||
Reference in New Issue
Block a user