emacs-framebuffer

Emacs library to show images and documents in console using Linux framebuffer
Log | Files | Refs

commit 40b79bd3cf6f3325d995624e296327250f105ef9
parent be81bcbe4ffc8757e6dfad6e4a4af11656e3d285
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 11 Sep 2022 17:47:56 +0200

no tabs

Diffstat:
Memacs-framebuffer.el | 30+++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/emacs-framebuffer.el b/emacs-framebuffer.el @@ -137,7 +137,7 @@ (defun framebuffer-local-cache-directory () (let ((z (or framebuffer-cache-directory temporary-file-directory))) (if (file-remote-p z) - (error "framebuffer-cache-directory is remote %s" z) + (error "framebuffer-cache-directory is remote %s" z) z))) (defun framebuffer-local-cache-file (name extension) @@ -146,16 +146,16 @@ (defun framebuffer-file-hash (file) (with-temp-buffer (if (file-remote-p file) - (process-file "sha256sum" file t) + (process-file "sha256sum" file t) (call-process "sha256sum" file t)) (buffer-substring (point-min) (+ (point-min) 64)))) (defun framebuffer-cache-remote (file) (if (file-remote-p file) (let ((z (framebuffer-local-cache-file (framebuffer-file-hash file) - (file-name-extension file)))) - (unless (file-readable-p z) - (copy-file file z)) + (file-name-extension file)))) + (unless (file-readable-p z) + (copy-file file z)) z) file)) @@ -198,8 +198,8 @@ (defun framebuffer-tty () (or framebuffer-tty (setq framebuffer-tty - (framebuffer-tty-p - (file-chase-links (format "/proc/%d/fd/0" (emacs-pid))))))) + (framebuffer-tty-p + (file-chase-links (format "/proc/%d/fd/0" (emacs-pid))))))) ;; TODO file-exists-p should return filename, not t (defun framebuffer-file-exists-p (filename) @@ -654,27 +654,27 @@ (defun framebuffer-fbpdf (filename) (suspend-emacs (format "fbpdf -w %s; fg" - (shell-quote-argument (expand-file-name filename))))) + (shell-quote-argument (expand-file-name filename))))) (defun framebuffer-hh:mm:ss (sec) (etypecase sec (string sec) (integer (let* ((m (mod sec 3600)) - (s (mod m 60))) + (s (mod m 60))) (format "%d:%02d:%02d" (floor sec 3600) (floor (- m s) 60) s))))) (defun framebuffer-fbmpv (filename &optional position) (suspend-emacs (format "mpv --vo=drm --osd-level=3 %s%s %s; fg" - (if position "--start=" "") - (if position (framebuffer-hh:mm:ss position) "") - (shell-quote-argument (expand-file-name filename))))) + (if position "--start=" "") + (if position (framebuffer-hh:mm:ss position) "") + (shell-quote-argument (expand-file-name filename))))) (defun framebuffer-fbview () (interactive) (let* ((filename (dired-file-name-at-point)) - (x (file-name-extension filename))) + (x (file-name-extension filename))) (cond ((member x '("pdf")) (framebuffer-fbpdf filename)) ((member x '("mkv" "mp4" "ogg" "webm")) (framebuffer-fbmpv filename))))) @@ -728,7 +728,7 @@ (destructuring-bind (x1 y1 x2 y2) (window-edges (get-buffer-window) t) (let* ((fw (frame-width)) (fh (frame-height)) - (stride (framebuffer-stride)) + (stride (framebuffer-stride)) (cw (floor fbw fw)) (ch (floor fbh fh)) (wx (* x1 cw)) @@ -765,7 +765,7 @@ (set-buffer-multibyte nil) (insert-file-contents-literally "/dev/fb0") (let ((bpp (framebuffer-bits-per-pixel)) - (stride (framebuffer-stride)) + (stride (framebuffer-stride)) (fb (current-buffer))) (with-temp-buffer (set-buffer-multibyte nil)