From: Olaf Dietsche <olaf+list.orgmode@olafdietsche.de>
To: Herbert Sitz <hsitz@nwlink.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: problem with command-line call to emacsclient
Date: Sat, 02 Jul 2011 11:57:26 +0200 [thread overview]
Message-ID: <87oc1dc8e1.fsf@rat.lan> (raw)
In-Reply-To: <loom.20110702T063456-445@post.gmane.org> (Herbert Sitz's message of "Sat, 2 Jul 2011 04:42:30 +0000 (UTC)")
Herbert Sitz <hsitz@nwlink.com> writes:
> I'm making a call to an emacsclient and trying to figure out how to get the
> buffer to unload at the end of the function I'm calling. I know kill-buffer
> isn't supposed to unload the buffer but I can't figure out what will. I've
> tried server-edit and server-kill-buffer in place of kill-buffer below and they
> also haven't worked. The buffer gets "pushed to the kill buffer", but remains
> loaded.
>
> The problem with having buffer remain loaded is when I redo the command-line
> call after editing the org file outside of emacs it prompts user for whether to
> reload changed file. One option would be to simply disable that prompt, I
> guess, but I'd rather be able to clear the buffer.
>
> Here's the function I'm calling:
> ----------------------------------
> (defun vimorg-export-publish (fname exp-function)
> (find-file fname)
> (funcall exp-function nil)
> (kill-buffer) )
> ---------------------------------
I tried this in *scratch* and it works fine:
(defun test-kill-buffer (fname)
(find-file fname)
(kill-buffer))
C-x C-e
(test-kill-buffer "/tmp/abc.txt")
C-x C-e
Repeat the steps and leave out the "(kill-buffer)" and the file
/tmp/abc.txt remains in emacs.
>
> And here's sample command line that calls it. Strange characters are because
> it's on Windows system, but it works fine other than that the buffer is not
> unloaded at end of vimorg-export-publish function:
> -----------------------------
> c:\users\herbert\emacsclientw.exe --eval ^"(vimorg-export-publish
> \^"~/myorgfile.org\^" 'org-export-as-html-and-open )^"
> ------------------------------
So it must be something with (funcall exp-function) or exp-function,
which prevents unloading `fname'.
Maybe org-export-as-html-and-open changes buffers. So, I guess either a
save-excursion around (funcall ...) or:
(defun test-kill-buffer (fname exp-function)
(let ((buf (find-file fname)))
(funcall exp-function)
(kill-buffer buf)))
(test-kill-buffer "/tmp/abc.txt" 'some-function-to-call)
will do the trick.
Regards, Olaf
next prev parent reply other threads:[~2011-07-02 9:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-02 4:42 problem with command-line call to emacsclient Herbert Sitz
2011-07-02 9:57 ` Olaf Dietsche [this message]
2011-07-02 15:32 ` Herbert Sitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oc1dc8e1.fsf@rat.lan \
--to=olaf+list.orgmode@olafdietsche.de \
--cc=emacs-orgmode@gnu.org \
--cc=hsitz@nwlink.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).