Introduce letf! convenience macro
A more succinct cl-letf, which allows for local functions and macros.
This commit is contained in:
parent
c3a84f0fbf
commit
d12752324a
12 changed files with 113 additions and 115 deletions
|
@ -50,7 +50,7 @@ you're done. This can be called from an external shell script."
|
|||
(with-selected-frame frame
|
||||
(require 'org-capture)
|
||||
(condition-case ex
|
||||
(cl-letf (((symbol-function #'pop-to-buffer) #'switch-to-buffer))
|
||||
(letf! ((#'pop-to-buffer #'switch-to-buffer))
|
||||
(switch-to-buffer (doom-fallback-buffer))
|
||||
(let ((org-capture-initial initial-input)
|
||||
org-capture-entry)
|
||||
|
|
|
@ -539,11 +539,9 @@ current workspace (and clean them up)."
|
|||
;; upstream (if ever).
|
||||
(defadvice! +org--fix-inline-images-for-imagemagick-users-a (orig-fn &rest args)
|
||||
:around #'org-display-inline-images
|
||||
(cl-letf* ((old-create-image (symbol-function #'create-image))
|
||||
((symbol-function #'create-image)
|
||||
(lambda (file-or-data &optional type data-p &rest props)
|
||||
(let ((type (if (plist-get props :width) type)))
|
||||
(apply old-create-image file-or-data type data-p props)))))
|
||||
(letf! (defun create-image (file-or-data &optional type data-p &rest props)
|
||||
(let ((type (if (plist-get props :width) type)))
|
||||
(apply create-image file-or-data type data-p props)))
|
||||
(apply orig-fn args)))
|
||||
|
||||
(defadvice! +org--fix-inconsistent-uuidgen-case-a (uuid)
|
||||
|
|
|
@ -41,20 +41,19 @@
|
|||
(defadvice! +org-present--narrow-to-subtree-a (orig-fn &rest args)
|
||||
"Narrow to the target subtree when you start the presentation."
|
||||
:around #'org-tree-slide--display-tree-with-narrow
|
||||
(cl-letf (((symbol-function #'org-narrow-to-subtree)
|
||||
(lambda ()
|
||||
(save-excursion
|
||||
(save-match-data
|
||||
(org-with-limited-levels
|
||||
(narrow-to-region
|
||||
(progn
|
||||
(when (org-before-first-heading-p)
|
||||
(org-next-visible-heading 1))
|
||||
(ignore-errors (org-up-heading-all 99))
|
||||
(forward-line 1)
|
||||
(point))
|
||||
(progn (org-end-of-subtree t t)
|
||||
(when (and (org-at-heading-p) (not (eobp)))
|
||||
(backward-char 1))
|
||||
(point)))))))))
|
||||
(letf! ((defun org-narrow-to-subtree ()
|
||||
(save-excursion
|
||||
(save-match-data
|
||||
(org-with-limited-levels
|
||||
(narrow-to-region
|
||||
(progn
|
||||
(when (org-before-first-heading-p)
|
||||
(org-next-visible-heading 1))
|
||||
(ignore-errors (org-up-heading-all 99))
|
||||
(forward-line 1)
|
||||
(point))
|
||||
(progn (org-end-of-subtree t t)
|
||||
(when (and (org-at-heading-p) (not (eobp)))
|
||||
(backward-char 1))
|
||||
(point))))))))
|
||||
(apply orig-fn args))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue