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

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

Re: Question about backup files


From: Reiner Steib
Subject: Re: Question about backup files
Date: Tue, 01 Oct 2002 17:06:15 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

On Tue, Oct 01 2002, Ben Key wrote:

> My question is, is it possible to create a more simplified
> keystroke assignment that implements the same behavior
> as `C-u C-u C-u C-x C-s'.  For example, I would like to assign
> this behavior to 'ESC C-x C-s'.

First you have to find out what function is called by `C-x C-s':

,----[ C-h k C-x C-s ]
| C-x C-s runs the command save-buffer
|    which is an interactive compiled Lisp function in `files'.
| It is bound to <f2>, C-x C-s, <menu-bar> <files> <save-buffer>.
| (save-buffer &optional ARGS)
| 
| Save current buffer in visited file if modified.  Versions described below.
| By default, makes the previous version into a backup file
|  if previously requested or if this is the first save.
| With 1 C-u, marks this version
|  to become a backup when the next save is done.
| With 2 C-u's,
|  unconditionally makes the previous version into a backup file.
| With 3 C-u's, marks this version
|  to become a backup when the next save is done,
|  and unconditionally makes the previous version into a backup file.
| 
| With argument of 0, never make the previous version into a backup file.
`----

"ESC C-x (translated from <escape> C-x) runs the command eval-defun"
so you should use a different key, e.g.:

(define-key global-map [(shift f5)]
  '(lambda ()
     (interactive)
     (save-buffer 4))) ;; C-u ==> 4
(define-key global-map [(ctrl f5)]
  '(lambda ()
     (interactive)
     (save-buffer (* 4 4)))) ;; C-u C-u ==> 4*4
(define-key global-map [(shift ctrl f5)]
  '(lambda ()
     (interactive)
     (save-buffer (* 4 4 4)))) ;; C-u C-u C-u ==> 4*4*4

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/


reply via email to

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