[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real 735ce86 028/160: Cleaned up hooks
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real 735ce86 028/160: Cleaned up hooks |
Date: |
Wed, 6 Oct 2021 16:58:08 -0400 (EDT) |
branch: externals/org-real
commit 735ce86586a49f24452f2ba7a24d82e19158af36
Author: Tyler Grinn <tylergrinn@gmail.com>
Commit: Tyler Grinn <tylergrinn@gmail.com>
Cleaned up hooks
---
org-real.el | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/org-real.el b/org-real.el
index bcefb29..f56c022 100644
--- a/org-real.el
+++ b/org-real.el
@@ -425,6 +425,8 @@ matching the one returned from `completing-read'."
existing-containers
`((:name ,result)))))
+;;; Hooks
+
(defun org-real--read-string-advice (orig prompt link &rest args)
"Advise `read-string' during `org-insert-link' to use custom completion.
@@ -434,24 +436,20 @@ passed to it."
(org-real-complete link)
(apply orig prompt link args)))
-(defun org-real--insert-link-before (&rest args)
+(defun org-real--maybe-edit-link (orig &rest args)
"Advise `org-insert-link' to advise `read-string' during editing of a link.
ARGS are the arguments passed to `org-insert-link'."
- (advice-add 'read-string :around #'org-real--read-string-advice))
-
-(defun org-real--insert-link-after (&rest args)
- "Advise `org-insert-link' to advise `read-string' during editing of a link.
+ (advice-add 'read-string :around #'org-real--read-string-advice)
+ (unwind-protect
+ (if (called-interactively-p)
+ (call-interactively orig)
+ (apply orig args))
+ (advice-remove 'read-string #'org-real--read-string-advice)))
-ARGS are the arguments passed to `org-insert-link'."
- (advice-remove 'read-string #'org-real--read-string-advice)
- (org-real--apply))
+(advice-add 'org-insert-link :around #'org-real--maybe-edit-link)
-
-(advice-add 'org-insert-link :before #'org-real--insert-link-before)
-(advice-add 'org-insert-link :after #'org-real--insert-link-after)
-
-(defun org-real--apply ()
+(defun org-real--apply (&rest args)
"Apply any changes to the current buffer from the last inserted real link."
(let (new-link new-desc replace-all)
(cond
@@ -523,6 +521,8 @@ ARGS are the arguments passed to `org-insert-link'."
(pop new-containers)))))
(message nil))
+(advice-add 'org-insert-link :after #'org-real--apply)
+
;;;; Pretty printing
(defun org-real--pp (box &optional containers)
- [elpa] branch externals/org-real created (now ab46371), ELPA Syncer, 2021/10/06
- [elpa] externals/org-real a040280 003/160: Added primary slot to color last element in url, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real cad260e 002/160: Removed unused box slot, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real b2dcbfc 001/160: initial commit, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 49c8920 008/160: Removed server stage from ci/cd, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real f281b65 010/160: Typo, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real e0eac63 019/160: Updated preposition list, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 735ce86 028/160: Cleaned up hooks,
ELPA Syncer <=
- [elpa] externals/org-real 4fe5b9f 036/160: Renamed md5 command, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 0974b67 023/160: Make changes to satisfy elc compiler, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 4c2915a 033/160: Updated README, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 89d616e 024/160: Check compilation during ci/cd pipeline, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real ed47eaa 048/160: Using stored values for computing top left width and height, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real c1a21a5 050/160: Added 'on top of' preposition; update customization vars, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 180d374 014/160: Standardized pretty printing for org-real-world and opening a link, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 356767c 034/160: Added org-real-pkg for multifile package, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real dd03f41 025/160: Initial release, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 0b764c7 022/160: get-width compares children with margins included, ELPA Syncer, 2021/10/06