[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/eat 10d9f3cb56 11/15: Use 'mapc' to make & kill multiple l
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/eat 10d9f3cb56 11/15: Use 'mapc' to make & kill multiple local variables |
Date: |
Tue, 29 Nov 2022 05:58:39 -0500 (EST) |
branch: elpa/eat
commit 10d9f3cb562a063137f3bbdb94a31beb54ee2100
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Use 'mapc' to make & kill multiple local variables
* eat.el (eat-blink-mode, eat--cursor-blink-mode, eat-mode)
(eat--eshell-local-mode, eat-trace-replay-mode): Use 'mapc' to
make & kill multiple local variables.
---
eat.el | 194 ++++++++++++++++++++++++++++++-----------------------------------
1 file changed, 90 insertions(+), 104 deletions(-)
diff --git a/eat.el b/eat.el
index 14d182d923..bfb4e8a1a7 100644
--- a/eat.el
+++ b/eat.el
@@ -4983,36 +4983,30 @@ return \"eat-color\", otherwise return \"eat-mono\"."
(define-minor-mode eat-blink-mode
"Toggle blinking of text with blink attribute."
:lighter " Eat-Blink"
- (cond
- (eat-blink-mode
- (setq eat-blink-mode nil)
- (require 'face-remap)
- (setq eat-blink-mode t)
- (make-local-variable 'eat--slow-blink-state)
- (make-local-variable 'eat--fast-blink-state)
- (make-local-variable 'eat--slow-blink-remap)
- (make-local-variable 'eat--fast-blink-remap)
- (make-local-variable 'eat--slow-blink-timer)
- (make-local-variable 'eat--fast-blink-timer)
- (setq eat--slow-blink-state nil eat--fast-blink-state nil
- eat--slow-blink-remap
- (face-remap-add-relative 'eat-term-slow-blink '(:box nil))
- eat--fast-blink-remap
- (face-remap-add-relative 'eat-term-fast-blink '(:box nil)))
- (add-hook 'pre-command-hook #'eat--blink-stop-timers nil t)
- (add-hook 'post-command-hook #'eat--blink-start-timers nil t))
- (t
- (eat--blink-stop-timers)
- (face-remap-remove-relative eat--slow-blink-remap)
- (face-remap-remove-relative eat--fast-blink-remap)
- (remove-hook 'pre-command-hook #'eat--blink-stop-timers t)
- (remove-hook 'post-command-hook #'eat--blink-start-timers t)
- (kill-local-variable 'eat--slow-blink-state)
- (kill-local-variable 'eat--fast-blink-state)
- (kill-local-variable 'eat--slow-blink-remap)
- (kill-local-variable 'eat--fast-blink-remap)
- (kill-local-variable 'eat--slow-blink-timer)
- (kill-local-variable 'eat--fast-blink-timer))))
+ (let ((locals '( eat--slow-blink-state eat--fast-blink-state
+ eat--slow-blink-remap eat--fast-blink-remap
+ eat--slow-blink-timer eat--fast-blink-timer)))
+ (cond
+ (eat-blink-mode
+ (setq eat-blink-mode nil)
+ (require 'face-remap)
+ (setq eat-blink-mode t)
+ (mapc #'make-local-variable locals)
+ (setq eat--slow-blink-state nil eat--fast-blink-state nil
+ eat--slow-blink-remap
+ (face-remap-add-relative 'eat-term-slow-blink '(:box nil))
+ eat--fast-blink-remap
+ (face-remap-add-relative 'eat-term-fast-blink
+ '(:box nil)))
+ (add-hook 'pre-command-hook #'eat--blink-stop-timers nil t)
+ (add-hook 'post-command-hook #'eat--blink-start-timers nil t))
+ (t
+ (eat--blink-stop-timers)
+ (face-remap-remove-relative eat--slow-blink-remap)
+ (face-remap-remove-relative eat--fast-blink-remap)
+ (remove-hook 'pre-command-hook #'eat--blink-stop-timers t)
+ (remove-hook 'post-command-hook #'eat--blink-start-timers t)
+ (mapc #'kill-local-variable locals)))))
;;;; Buffer-local Cursor Blinking.
@@ -5059,23 +5053,24 @@ return \"eat-color\", otherwise return \"eat-mono\"."
(define-minor-mode eat--cursor-blink-mode
"Toggle blinking of cursor."
:interactive nil
- (cond
- (eat--cursor-blink-mode
- (make-local-variable 'eat--cursor-blink-state)
- (make-local-variable 'eat--cursor-blink-timer)
- (setq eat--cursor-blink-state nil eat--cursor-blink-timer nil)
- (add-hook 'pre-command-hook #'eat--cursor-blink-stop-timers nil t)
- (add-hook 'post-command-hook #'eat--cursor-blink-start-timers
- nil t)
- (when (current-idle-time)
- (eat--cursor-blink-start-timers)))
- (t
- (eat--cursor-blink-stop-timers)
- (remove-hook 'pre-command-hook #'eat--cursor-blink-stop-timers t)
- (remove-hook 'post-command-hook #'eat--cursor-blink-start-timers
- t)
- (kill-local-variable 'eat--cursor-blink-state)
- (kill-local-variable 'eat--cursor-blink-timer))))
+ (let ((locals '(eat--cursor-blink-state eat--cursor-blink-timer)))
+ (cond
+ (eat--cursor-blink-mode
+ (mapc #'make-local-variable locals)
+ (setq eat--cursor-blink-state nil eat--cursor-blink-timer nil)
+ (add-hook 'pre-command-hook #'eat--cursor-blink-stop-timers nil
+ t)
+ (add-hook 'post-command-hook #'eat--cursor-blink-start-timers
+ nil t)
+ (when (current-idle-time)
+ (eat--cursor-blink-start-timers)))
+ (t
+ (eat--cursor-blink-stop-timers)
+ (remove-hook 'pre-command-hook #'eat--cursor-blink-stop-timers
+ t)
+ (remove-hook 'post-command-hook #'eat--cursor-blink-start-timers
+ t)
+ (mapc #'kill-local-variable locals)))))
;;;; User Interface.
@@ -5494,21 +5489,21 @@ END if it's safe to do so."
(define-derived-mode eat-mode fundamental-mode "Eat"
"Major mode for Eat."
:group 'eat-ui
- (make-local-variable 'buffer-read-only)
- (make-local-variable 'buffer-undo-list)
- (make-local-variable 'filter-buffer-substring-function)
- (make-local-variable 'mode-line-process)
- (make-local-variable 'mode-line-buffer-identification)
- (make-local-variable 'glyphless-char-display)
- (make-local-variable 'cursor-type)
- (make-local-variable 'track-mouse)
- (make-local-variable 'eat--terminal)
- (make-local-variable 'eat--process)
- (make-local-variable 'eat--synchronize-scroll-function)
- (make-local-variable 'eat--mouse-grabbing-type)
- (make-local-variable 'eat--pending-output-chunks)
- (make-local-variable 'eat--output-queue-first-chunk-time)
- (make-local-variable 'eat--process-output-queue-timer)
+ (mapc #'make-local-variable '(buffer-read-only
+ buffer-undo-list
+ filter-buffer-substring-function
+ mode-line-process
+ mode-line-buffer-identification
+ glyphless-char-display
+ cursor-type
+ track-mouse
+ eat--terminal
+ eat--process
+ eat--synchronize-scroll-function
+ eat--mouse-grabbing-type
+ eat--pending-output-chunks
+ eat--output-queue-first-chunk-time
+ eat--process-output-queue-timer))
;; This is intended; input methods don't work on read-only buffers.
(setq buffer-read-only nil buffer-undo-list t
eat--synchronize-scroll-function #'eat--synchronize-scroll
@@ -6168,42 +6163,33 @@ sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
"Toggle Eat terminal emulation is Eshell."
:interactive nil
:keymap eat-eshell-emacs-mode-map
- (cond
- (eat--eshell-local-mode
- (make-local-variable 'cursor-type)
- (make-local-variable 'glyphless-char-display)
- (make-local-variable 'track-mouse)
- (make-local-variable 'filter-buffer-substring-function)
- (make-local-variable 'eat--terminal)
- (make-local-variable 'eat--process)
- (make-local-variable 'eat--synchronize-scroll-function)
- (make-local-variable 'eat--mouse-grabbing-type)
- (make-local-variable 'eat--pending-output-chunks)
- (make-local-variable 'eat--output-queue-first-chunk-time)
- (make-local-variable 'eat--process-output-queue-timer)
- (setq eat--synchronize-scroll-function
- #'eat--eshell-synchronize-scroll
- filter-buffer-substring-function
- #'eat--filter-buffer-substring)
- ;; Make sure glyphless character don't display a huge box glyph,
- ;; that would break the display.
- (eat--setup-glyphless-chars)
- (when eat-enable-blinking-text
- (eat-blink-mode +1)))
- (t
- (when eat-enable-blinking-text
- (eat-blink-mode -1))
- (kill-local-variable 'cursor-type)
- (kill-local-variable 'glyphless-char-display)
- (kill-local-variable 'track-mouse)
- (make-local-variable 'filter-buffer-substring-function)
- (kill-local-variable 'eat--terminal)
- (kill-local-variable 'eat--process)
- (kill-local-variable 'eat--synchronize-scroll-function)
- (kill-local-variable 'eat--mouse-grabbing-type)
- (kill-local-variable 'eat--pending-output-chunks)
- (kill-local-variable 'eat--output-queue-first-chunk-time)
- (kill-local-variable 'eat--process-output-queue-timer))))
+ (let ((locals '(cursor-type
+ glyphless-char-display
+ track-mouse
+ filter-buffer-substring-function
+ eat--terminal
+ eat--process
+ eat--synchronize-scroll-function
+ eat--mouse-grabbing-type
+ eat--pending-output-chunks
+ eat--output-queue-first-chunk-time
+ eat--process-output-queue-timer)))
+ (cond
+ (eat--eshell-local-mode
+ (mapc #'make-local-variable locals)
+ (setq eat--synchronize-scroll-function
+ #'eat--eshell-synchronize-scroll
+ filter-buffer-substring-function
+ #'eat--filter-buffer-substring)
+ ;; Make sure glyphless character don't display a huge box glyph,
+ ;; that would break the display.
+ (eat--setup-glyphless-chars)
+ (when eat-enable-blinking-text
+ (eat-blink-mode +1)))
+ (t
+ (when eat-enable-blinking-text
+ (eat-blink-mode -1))
+ (mapc #'kill-local-variable locals)))))
(declare-function eshell-gather-process-output "esh-proc"
(command args))
@@ -6805,12 +6791,12 @@ N defaults to 1. Interactively, N is the prefix
argument."
(define-derived-mode eat-trace-replay-mode special-mode
"Eat-Trace-Replay"
"Major mode for replaying terminal according to trace output."
- (make-local-variable 'eat--terminal)
- (make-local-variable 'eat--trace-replay-source-buffer)
- (make-local-variable 'eat--trace-replay-recording-start-time)
- (make-local-variable 'eat--trace-replay-progress)
- (make-local-variable 'eat--trace-replay-frame-count)
- (make-local-variable 'eat--trace-replay-progress-frame)
+ (mapc #'make-local-variable '(eat--terminal
+ eat--trace-replay-source-buffer
+ eat--trace-replay-recording-start-time
+ eat--trace-replay-progress
+ eat--trace-replay-frame-count
+ eat--trace-replay-progress-frame))
(setq-local
mode-line-process
'("[" (:eval (number-to-string eat--trace-replay-progress-frame))
- [nongnu] elpa/eat updated (f3fed64957 -> d8171b9a8c), ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 0e82988d6f 03/15: Use 'setf' + 'plist-get' instead of 'plist-put', ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat a736f08ea9 02/15: Prefer 'and-let*' and 'when-let*' over 'when-let', ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 9a9d9165f2 05/15: * eat.el (eat--bell): Use 'ding' instead of 'beep', ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 59c0745e75 12/15: Don't put 'error' as the only then part of 'if', ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 3e496e8db8 14/15: ; Merge diverged elpa/eat branch of NonGNU ELPA, ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 5ce98430e8 07/15: Use more readable '?\C-\s' instead of '?\C-\ ', ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 10d9f3cb56 11/15: Use 'mapc' to make & kill multiple local variables,
ELPA Syncer <=
- [nongnu] elpa/eat 2dd4e42773 01/15: Prefer 'pcase-exhaustive' over 'pcase', ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat dc99739fb8 04/15: * eat.el (eat--trace-exec): Use "-*- mode: MD -*-", ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat c19cf68b28 08/15: * eat.el (eat-term-make-keymap): Use 'cl-flet', ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 1b2b7aee26 13/15: Bump version to 0.1, ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 528bfe424d 10/15: Put declare-function and defvar outside functions, ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 31f93da3fd 06/15: * eat.el (eat-mode): Fix char mode 'help-echo', ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat 86e247137b 09/15: Use 'vector' directly instead of backquote, ELPA Syncer, 2022/11/29
- [nongnu] elpa/eat d8171b9a8c 15/15: ; Ignore a commit while generating ChangeLog, ELPA Syncer, 2022/11/29