[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/edit-indirect bdc8f542fe 23/28: Don't run buffer-local aft
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/edit-indirect bdc8f542fe 23/28: Don't run buffer-local after-creation-hook twice |
Date: |
Thu, 7 Jul 2022 11:59:14 -0400 (EDT) |
branch: elpa/edit-indirect
commit bdc8f542fe8430ba55f9a24a7910639d4c434422
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>
Don't run buffer-local after-creation-hook twice
Fixes #16.
---
edit-indirect.el | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/edit-indirect.el b/edit-indirect.el
index 50281e8398..9a859d38aa 100644
--- a/edit-indirect.el
+++ b/edit-indirect.el
@@ -2,14 +2,14 @@
;; Author: Fanael Linithien <fanael4@gmail.com>
;; URL: https://github.com/Fanael/edit-indirect
-;; Version: 0.1.5
+;; Version: 0.1.6
;; Package-Requires: ((emacs "24.3"))
;; This file is NOT part of GNU Emacs.
;; SPDX-License-Identifier: BSD-2-clause
;;
-;; Copyright (c) 2014-2017, Fanael Linithien
+;; Copyright (c) 2014-2020, Fanael Linithien
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
@@ -292,10 +292,18 @@ OVERLAY is the overlay, see `edit-indirect--overlay'."
(funcall (edit-indirect--buffer-local-value
parent-buffer edit-indirect-guess-mode-function)
parent-buffer beg end)
- (let ((edit-indirect-after-creation-hook
- (edit-indirect--buffer-local-value
- parent-buffer edit-indirect-after-creation-hook)))
- (run-hooks 'edit-indirect-after-creation-hook)))
+ (if (local-variable-p 'edit-indirect-after-creation-hook parent-buffer)
+ ;; Copy the parent buffer hook to the indirect buffer instead of
+ ;; let-binding it to avoid running it twice.
+ (setq-local edit-indirect-after-creation-hook
+ (edit-indirect--buffer-local-value
+ parent-buffer edit-indirect-after-creation-hook))
+ ;; No need to do copy anything if the parent buffer has no local value,
+ ;; the global value will be used instead. Just kill the local value in
+ ;; the indirect buffer in case a prior hook set it, because we're not
+ ;; supposed to use it.
+ (kill-local-variable 'edit-indirect-after-creation-hook))
+ (run-hooks 'edit-indirect-after-creation-hook))
buffer))
(defun edit-indirect--create-overlay (beg end)
- [nongnu] branch elpa/edit-indirect created (now f80f63822f), ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 1d0cabfbe7 02/28: Clarify how this package differs from clone-indirect-buffer., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 56e3231915 01/28: Initial import., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect ac56a2ff8d 03/28: Add C-c C-c binding for edit-indirect-commit., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect e01e7eeb79 04/28: Extract a nested let into a function., ELPA Syncer, 2022/07/07
- [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 <=
- [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, 2022/07/07
- [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