emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/marginalia 4069094 131/241: get rid of marginalia--buff


From: Stefan Monnier
Subject: [elpa] externals/marginalia 4069094 131/241: get rid of marginalia--buffer-bytes
Date: Fri, 28 May 2021 20:49:12 -0400 (EDT)

branch: externals/marginalia
commit 40690947c062756a5c69c54a03e838637ef28991
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    get rid of marginalia--buffer-bytes
---
 marginalia.el | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/marginalia.el b/marginalia.el
index 56627e4..c57b46e 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -514,26 +514,16 @@ Similar to `marginalia-annotate-symbol', but does not 
show symbol class."
   "Annotate coding system CAND with its description."
   (marginalia--documentation (coding-system-doc-string (intern cand))))
 
-(defun marginalia--buffer-bytes (buf)
-  "Return byte size of BUF."
-  (with-current-buffer buf
-    (position-bytes (let ((max (point-max)))
-                      (if (= (buffer-size) (- max (point-min)))
-                          max ;; Buffer not narrowed
-                        (save-restriction
-                          (widen)
-                          (point-max)))))))
-
 (defun marginalia-annotate-buffer (cand)
   "Annotate buffer CAND with modification status, file name and major mode."
   (when-let (buffer (get-buffer cand))
     (marginalia--fields
-     ((file-size-human-readable (marginalia--buffer-bytes buffer)) :width 7 
:face 'marginalia-size)
+     ((format-mode-line "%I" nil nil buffer) :width 7 :face 'marginalia-size)
      ((concat
        (if (buffer-modified-p buffer) "*" " ")
        (if (buffer-local-value 'buffer-read-only buffer) "%" " "))
       :face 'marginalia-modified)
-     ((format-mode-line (buffer-local-value 'mode-name buffer))
+     ((format-mode-line 'mode-name nil nil buffer)
       :width 20 :face 'marginalia-mode)
      ((when-let (file (buffer-file-name buffer))
         (abbreviate-file-name file))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]