[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/marginalia 27cd29d 101/241: add buffer size annotation,
From: |
Stefan Monnier |
Subject: |
[elpa] externals/marginalia 27cd29d 101/241: add buffer size annotation, fix #29 |
Date: |
Fri, 28 May 2021 20:49:05 -0400 (EDT) |
branch: externals/marginalia
commit 27cd29d8564c3577acd4d71faaa31da0cd79aaef
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
add buffer size annotation, fix #29
---
marginalia.el | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/marginalia.el b/marginalia.el
index e99595e..7c17376 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -470,10 +470,21 @@ 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)
((concat
(if (buffer-modified-p buffer) "*" " ")
(if (buffer-local-value 'buffer-read-only buffer) "%" " "))
@@ -528,7 +539,7 @@ using `minibuffer-force-complete' on the candidate CAND."
(file-attribute-modification-time attributes)) :face
'marginalia-date))))
(defun marginalia-annotate-project-file (cand)
- "Annotate file CAND with its size, modification time and other attributes."
+ "Annotate file CAND with its size, modification time and other attributes."
(when-let ((project (project-current))
(root (project-root project))
(file (expand-file-name cand root)))
- [elpa] externals/marginalia 17d539c 059/241: whitespace and comment adjustments, (continued)
- [elpa] externals/marginalia 17d539c 059/241: whitespace and comment adjustments, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 4a5ada6 063/241: smaller variable field, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 2f1bb7c 064/241: do not overwrite the face weights as per recommendation by @purcell, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 785297d 075/241: Indicate advised functions with an asterisk, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 0bd8061 077/241: marginalia--fields: allow alignment to the right by using a negative width, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia f16d26a 082/241: marginalia-annotate-symbol: add keybindings to commands, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia b0c24f7 088/241: introduce marginalia-annotate-command, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia bbde111 083/241: Annotate environment variables with their value, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 618fd9e 084/241: Improve formatting of environment variable annotation, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 3559cbb 095/241: update readme, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 27cd29d 101/241: add buffer size annotation, fix #29,
Stefan Monnier <=
- [elpa] externals/marginalia 3360875 113/241: Rename marginalia-cycle-annotators to marginalia-cycle, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 1fb2569 121/241: marginalia-annotate-minor-mode: fix support for consult, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 35cb523 127/241: add comment, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia d38a278 151/241: readme: do not export drawers, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 3febe72 155/241: fix #45, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 7d3f018 024/241: Add annotations for files and buffers, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia f083852 066/241: readme: add embark and consult links, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia ef325fc 073/241: In symbol annotator skip lines about advice in function docstring, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia d2a7923 069/241: improve marginalia-annotate-package, do not show nil for builtins, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 6e8ba6d 079/241: add marginalia-annotate-imenu, Stefan Monnier, 2021/05/28