help-gnu-emacs
[Top][All Lists]
Advanced

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

How to set 'buffer-save-without-query' from external program?


From: Thorsten Jolitz
Subject: How to set 'buffer-save-without-query' from external program?
Date: Fri, 09 Nov 2012 18:02:46 +0100
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.0.93 (gnu/linux)

Hi List, 

I open an emacs buffer for editing from an external program and face
three problems related with Emacs querying for user input: 

1. User-query "Revert the buffer"? 

This could be solved by setting a regexp to identify the buffer-name in
in customizable variable:

,---------------------
| revert-without-query
`---------------------

2. User-query "Save before exiting the buffer" (with C-x # or
   server-edit)?

I could not find a variable that allowed to specifiy this behaviour only
for certain files matching a regexp like above. I found the buffer-local
variable 'buffer-save-without-query' though and try to set it to non-nil
from the external program: 

,--------------------------------------------------
| # set input channel to file *F already opened
| # in an Emacsclient buffer
| (in "*F"
|    # try to set variable via call to 
|    # Emacsclient
|    (call 'emacsclient
|       "-s" "emacs1"
|       "-e" "(setq buffer-save-without-query t)" ) ...
`--------------------------------------------------

But this doesn't work, I'm still queried if I want to save the buffer on
exit, and C-h v in the *F buffer shows

,---------------------------------------------------------------
| buffer-save-without-query is a variable defined in `files.el'.
| Its value is nil
`---------------------------------------------------------------

How could I 'design' an external call to emacsclient that actually sets
this variable for the buffer editing the file that is used as input
channel by the external program?

1. Unwanted change in buffer focus after exiting

When I confirm the save-query and Emacsclient exits after 'server-edit
C-x #', the focus is returned to another Emacsclient window, and in that
window the visible buffer changes to the buffer I used to start the
client with, i.e. when I started the other Emacsclient with 

,---------------------------------------
| emacsclient -s emacs1 -c "~/notes.org"
`---------------------------------------

then the visible buffer is changed to notes.org, although I might have
been editing another buffer. 

How can I suppress this behaviour? The best solution would be if the
focus would return to the commandline of the external program that
called (and then closed) an emacsclient instance for editing, and not to
another open emacsclient window.

-- 
cheers,
Thorsten





reply via email to

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