On 2011-09-26, Uwe Brauer <oub(a)mat.ucm.es> wrote:
[ actually always]
I have the following in my .emacs (or whatever). It's not quite
perfect, but it's good enough to avoid major annoyance:
; quick hack to make checkout keep point roughly in place
(defun vc-checkout (file &optional writable rev)
"Retrieve a copy of the latest version of the given file."
;; If ftp is on this system and the name matches the ange-ftp format
;; for a remote file, the user is trying something that won't work.
(if (and (string-match "^/[^/:]+:" file) (vc-find-binary "ftp"))
(error "Sorry, you can't check out files over FTP"))
(let ((p (point)))
(vc-backend-checkout file writable rev)
(vc-resynch-buffer file t t)
(goto-char p)))
I tried the following:
(defadvice vc-toggle-read-only (after save-point activate)
(let ((p (point)))
(goto-char p)))
;;(defadvice vc-next-action-on-file (after save-point activate)
(let ((p (point)))
(goto-char p)))
(defadvice vc-checkin (before save-point activate)
(let ((p (point)))
(goto-char p)))
I also tried instead of before, after or around.
It works, well sort of.
I forgot to tell that I use another hack which I sometimes
put into the after-save-hook:
(defun ensure-in-vc-or-check ()
"Automatically checkin file ,v can be in the same directory or in the
subdirectory RCS. The idea is to call that function only for files
not for buffers. See the function ensure-in-vc-or-check-in-modes
which could be use in an apropriate HOOK."
(interactive)
(when (buffer-file-name)
(if (or (and (file-exists-p (format "%s,v" (buffer-file-name))))
(and (file-exists-p (format "RCS/%s,v" (file-name-nondirectory
buffer-file-name)))))
(progn
(vc-checkin (buffer-file-name) nil "")
(vc-toggle-read-only)
(message "Checked in"))
(progn
(message "You need to check this in! S-i")))))
Now that function ensure-in-vc-or-check *always* jumps to
the beginning of a buffer if there are keywords in. Without
keywords it does not jump.
I also tried to modify this function with save-excursion and
your idea with (let p.....
Does not help! I am desperate.
Uwe
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta