summaryrefslogtreecommitdiff
path: root/helm-buffers.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-11-20 10:26:17 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-11-20 10:26:17 +0100
commit3806d352f3553731501bdc0045103de109cac178 (patch)
tree397364c3bb88ffcec1c3617726bd98264648e5ed /helm-buffers.el
parent851d7174c7389f4d5f14c47d014a6bb5a670eff1 (diff)
Allows recording local changes to a non-file buffer (#1917)
* helm-buffers.el (helm-buffers-tick-counter): New. (helm-buffer--details): Use it.
Diffstat (limited to 'helm-buffers.el')
-rw-r--r--helm-buffers.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/helm-buffers.el b/helm-buffers.el
index 180194ff..c16d4966 100644
--- a/helm-buffers.el
+++ b/helm-buffers.el
@@ -154,6 +154,18 @@ this source is accessible and properly loaded."
"Face used for non-file buffers in `helm-buffers-list'."
:group 'helm-buffers-faces)
+(defvar helm-buffers-tick-counter nil
+ "Allows recording local changes to a non-file buffer.
+Typical usage of this var is for modes that want to see if
+their buffers have changed since last visit.
+Such programs may want to record tick counter after visiting their
+buffers like this:
+
+ (setq helm-buffers-tick-counter (buffer-modified-tick))
+
+Note that this variable is buffer-local.")
+(make-variable-buffer-local 'helm-buffers-tick-counter)
+
;;; Buffers keymap
;;
@@ -375,6 +387,13 @@ See `ido-make-buffer-list' for more infos."
(helm-buffer--show-details
name name-prefix file-name size mode dir
'helm-buffer-file 'helm-buffer-process nil details 'filebuf))
+ ;; A non-file, modified buffer
+ ((with-current-buffer name
+ (and helm-buffers-tick-counter
+ (/= helm-buffers-tick-counter (buffer-modified-tick))))
+ (helm-buffer--show-details
+ name (and proc name-prefix) dir size mode dir
+ 'helm-buffer-modified 'helm-buffer-process proc details 'nofile-mod))
;; Any non--file buffer.=>italic
(t
(helm-buffer--show-details