From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: [PATCH] org-capture: Add a custom to control save target file or not. Date: Wed, 26 Sep 2018 14:11:40 -0400 Message-ID: References: <19dc1211.1e75.162b770bd5c.Coremail.tumashu@163.com> <87po34y2ya.fsf@nicolasgoaziou.fr> <77a63bcf.32cc.162bcc4a5d0.Coremail.tumashu@163.com> <877epap70f.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5ELx-0006iS-Pn for emacs-orgmode@gnu.org; Wed, 26 Sep 2018 14:16:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5EIN-0007Bt-5e for emacs-orgmode@gnu.org; Wed, 26 Sep 2018 14:12:19 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:40257) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5EIM-0007Bi-TE for emacs-orgmode@gnu.org; Wed, 26 Sep 2018 14:12:19 -0400 Received: by mail-lf1-x12b.google.com with SMTP id t22-v6so14295027lfb.7 for ; Wed, 26 Sep 2018 11:12:18 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: tumashu Cc: emacs-org list , Nicolas Goaziou > Also that suggestion to use org-capture-after-finalize-hook does not > work.. I am investigating to find the right way. I got the captures to auto-save with the below work-around: (with-eval-after-load 'org-capture (defvar modi/org-capture-base-buffer nil) (defun modi/org-capture-before-finalize () (let ((base-buffer (buffer-base-buffer (current-buffer)))) (setq modi/org-capture-base-buffer base-buffer))) (add-hook 'org-capture-before-finalize-hook #'modi/org-capture-before-finalize) (defun modi/org-capture-save-buffer () (when modi/org-capture-base-buffer (let ((base-buffer-already-open (bufferp modi/org-capture-base-buffer))) (with-current-buffer modi/org-capture-base-buffer (save-buffer)))) (setq modi/org-capture-base-buffer nil)) ;Reset the buffer name cache (add-hook 'org-capture-after-finalize-hook #'modi/org-capture-save-buffer)) tumashu: I am wondering if it's possible to undo this commit and we can figure out how to prevent file saving during org-capture.