all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How make server-edit (an emacsclient function) NOT ask to confirm if I really want to save?
@ 2016-03-25 17:12 Chris Seberino
  2016-03-25 18:50 ` Emanuel Berg
       [not found] ` <mailman.8340.1458931829.843.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Seberino @ 2016-03-25 17:12 UTC (permalink / raw)
  To: help-gnu-emacs

How make server-edit (an emacsclient function) NOT ask to confirm if I really want to save?

Basically those confirmation messages sometimes are annoying.


cs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How make server-edit (an emacsclient function) NOT ask to confirm if I really want to save?
  2016-03-25 17:12 How make server-edit (an emacsclient function) NOT ask to confirm if I really want to save? Chris Seberino
@ 2016-03-25 18:50 ` Emanuel Berg
       [not found] ` <mailman.8340.1458931829.843.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2016-03-25 18:50 UTC (permalink / raw)
  To: help-gnu-emacs

Chris Seberino <cseberino@gmail.com> writes:

> How make server-edit (an emacsclient function) NOT
> ask to confirm if I really want to save?

If you "really want to save" - don't you get that
question because you *didn't* save? If so, wire `C-x
C-s' into your hands, the sooner the better...

But, to attempt to answer your question, check out if
there are suitable hooks around. `server-switch-hook'
or `server-done-hook', perhaps? There, you can put
a `save-buffer', or clear the modified status, if you
by chance on the contrary want to discard the edits...

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 19 Blogomatic articles -                   




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How make server-edit (an emacsclient function) NOT ask to confirm if I really want to save?
       [not found] ` <mailman.8340.1458931829.843.help-gnu-emacs@gnu.org>
@ 2016-03-25 23:26   ` Chris Seberino
  2016-03-26 19:09     ` Emanuel Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Seberino @ 2016-03-25 23:26 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel

Thanks for the reply.  Here's more context.  I wrote my own version control
system for fun.  To check in code, I first invoke a command to start a Mercurial shell command. Apparently to save my commit message, and finish checking in the
code, you need to use server-edit.  

Does that change anything?  Would those hooks you mentioned still be the way to go?

cs



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How make server-edit (an emacsclient function) NOT ask to confirm if I really want to save?
  2016-03-25 23:26   ` Chris Seberino
@ 2016-03-26 19:09     ` Emanuel Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2016-03-26 19:09 UTC (permalink / raw)
  To: help-gnu-emacs

Chris Seberino <cseberino@gmail.com> writes:

> Thanks for the reply. Here's more context. I wrote
> my own version control system for fun. To check in
> code, I first invoke a command to start a Mercurial
> shell command. Apparently to save my commit message,
> and finish checking in the code, you need to use
> server-edit.
>
> Does that change anything? Would those hooks you
> mentioned still be the way to go?

You'll have to check the documentation for each one.

In general, if you want something automatized at
command or event E, first see if there are any related
hooks, "after-E-hook", "before-E-hook", and the like.

If there are, put your stuff there, e.g.,

    ;; (setq text-mode-hook nil)
    (defun text-mode-hook-f ()
      (auto-fill-mode)
      (abbrev-mode) )
    (add-hook 'text-mode-hook #'text-mode-hook-f)

If there aren't any hooks, you can either use
so-called advices (which is "function composition" in
CS lingo). Place your stuff before or after E, which
you must isolate to one particular function. It can
help to put the new stuff in a function as well, e.g.,

    (defun gnus-summary-insert-all (&rest unused)
      (gnus-summary-insert-old-articles t) )
    (advice-add       'gnus-summary-limit-to-subject :before #'gnus-summary-insert-all)
    (advice-add       'gnus-summary-limit-to-author  :before #'gnus-summary-insert-all)
    ;; (advice-remove 'gnus-summary-limit-to-subject         #'gnus-summary-insert-all)
    ;; (advice-remove 'gnus-summary-limit-to-author          #'gnus-summary-insert-all)

Either that, or, which I think is simpler and less
error-prone, you can do your own function:

    (defun do-E-with-my-modification ()
      (interactive)
      (do-my-stuff)
      (E) ) ; or use `call-interactively' here for complete transparence

Then bind "do-E-with-my-modification" to a shortcut
and start using that instead. If you didn't use the
old shortcut to call E hundreds of times already, you
can assign a new shortcut to your modified version.
If old habits die hard, it is not a deadly sin to
overwrite the old one :)

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 19 Blogomatic articles -                   




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-26 19:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-25 17:12 How make server-edit (an emacsclient function) NOT ask to confirm if I really want to save? Chris Seberino
2016-03-25 18:50 ` Emanuel Berg
     [not found] ` <mailman.8340.1458931829.843.help-gnu-emacs@gnu.org>
2016-03-25 23:26   ` Chris Seberino
2016-03-26 19:09     ` Emanuel Berg

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.