[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/edit-indirect 7d9bcfced3 06/28: Extract buffer-local value
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/edit-indirect 7d9bcfced3 06/28: Extract buffer-local value handling into a macro. |
Date: |
Thu, 7 Jul 2022 11:59:13 -0400 (EDT) |
branch: elpa/edit-indirect
commit 7d9bcfced30f7b7d40cd5bf3ab0c62d0615fccc7
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>
Extract buffer-local value handling into a macro.
---
edit-indirect.el | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/edit-indirect.el b/edit-indirect.el
index 0aa51085ff..a6d5d98e2d 100644
--- a/edit-indirect.el
+++ b/edit-indirect.el
@@ -222,6 +222,16 @@ nil."
(throw 'done overlay)))
nil))
+(defmacro edit-indirect--buffer-local-value (buffer variable)
+ "Get the BUFFER local value of VARIABLE.
+VARIABLE shall be a symbol."
+ (unless (symbolp variable)
+ (signal 'wrong-type-argument (list #'symbolp variable)))
+ ;; `with-current-buffer' is used instead of `buffer-local-value' because
+ ;; the latter doesn't give warnings about free variables when
+ ;; byte-compiled.
+ `(with-current-buffer ,buffer ,variable))
+
(defun edit-indirect--create-indirect-buffer (beg end overlay)
"Create an edit-indirect buffer and return it.
@@ -237,15 +247,12 @@ OVERLAY is the overlay, see `edit-indirect--overlay'."
;; Use the buffer-local values from the parent buffer. Don't retrieve the
;; values before actual uses in case these variables are changed by some
;; of the many possible hooks.
- ;; `with-current-buffer' is used instead of `buffer-local-value' because
- ;; the latter doesn't give warnings about free variables when
- ;; byte-compiled.
- (funcall (with-current-buffer parent-buffer
- edit-indirect-guess-mode-function)
+ (funcall (edit-indirect--buffer-local-value
+ parent-buffer edit-indirect-guess-mode-function)
parent-buffer beg end)
(let ((edit-indirect-after-creation-hook
- (with-current-buffer parent-buffer
- edit-indirect-after-creation-hook)))
+ (edit-indirect--buffer-local-value
+ parent-buffer edit-indirect-after-creation-hook)))
(run-hooks 'edit-indirect-after-creation-hook)))
buffer))
- [nongnu] elpa/edit-indirect 273910a944 11/28: Ensure commit hooks are always called with the correct region., (continued)
- [nongnu] elpa/edit-indirect 273910a944 11/28: Ensure commit hooks are always called with the correct region., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 215d3a714a 16/28: Release version 0.1.3, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect de645d8144 21/28: Add edit-indirect-save function and keybinding, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 2fc8f382ee 19/28: Add before-commit-hook, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect bdc8f542fe 23/28: Don't run buffer-local after-creation-hook twice, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect f80f63822f 28/28: Make edit-indirect--should-quit-window persistent, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 03b6ac9ed1 25/28: Use a remap binding for save-buffer instead of hardcoded C-x C-s, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 7fffd87ac3 24/28: Don't modify buffer if nothing changed, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 16bcdbdae6 27/28: Add an overlay keymap for easy switching to active edit-indirect buffers, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect b461e559e1 05/28: Don't retrieve the buffer-local hook values before actual uses., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 7d9bcfced3 06/28: Extract buffer-local value handling into a macro.,
ELPA Syncer <=
- [nongnu] elpa/edit-indirect 6fa78ff6f1 07/28: Prohibit modification at the beginning of the overlay., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect f43936b3a4 12/28: Use `quit-window' instead of `kill-buffer-and-window`., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect d1ab87fdfb 14/28: Release version 0.1.2., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 032ac0ec69 20/28: Try to preserve markers when committing, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect e3d86416bc 26/28: Offer to commit edit-indirect buffers on save-buffers-kill-emacs, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect ce6e60c705 08/28: Require Emacs 24.3, for user-error., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect a28aba75f8 13/28: Don't separate sentences with double spaces., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 523f84cb7e 10/28: Release version 0.1.1., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 45c4c72864 09/28: Use our own error signals inheriting from user-error., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect c6b08f5cd7 15/28: Call quit-window only when a window is created, ELPA Syncer, 2022/07/07