emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature request: kill-buffer for org-capture-finalize


From: Ihor Radchenko
Subject: Re: Feature request: kill-buffer for org-capture-finalize
Date: Sun, 10 Sep 2023 10:57:46 +0000

Eduardo Suarez <esuarez@itccanarias.org> writes:

> On Sun, Sep 10, 2023 at 08:19:25AM +0000, Ihor Radchenko wrote:
>>   (defun my-org-capture-kill-buffer ()
>>     (when (equal current-prefix-arg '(16))
>>       (save-excursion
>>         (org-capture-goto-last-stored)
>>         (kill-buffer))))
>
> Thanks for the proposed solution. I have tried it and it didn't work for me. 
> Or
> it worked somehow. If it kills the buffer, then the buffer is opened again
> right after it is killed, jumping to the last stored position. I think this is
> because of the way the 'org-capture-finalize' function is implemented:

> ...

Right.

Then, what you can do is

(defun my-org-capture-finalize (arg)
"Like `org-capture-finalize', but kill Org buffer with double prefix arg."
  (interactive "P")
  (if (equal arg '(16))
    (save-excursion
      (org-capture-finalize)
      (org-capture-goto-last-stored)
      (kill-buffer))
   (org-capture-finalize arg)))
(define-key org-capture-mode-map "\C-c\C-c" #'my-org-capture-finalize)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]