+2009-11-13 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * x-dnd.el (x-dnd-maybe-call-test-function):
+ * window.el (split-window-vertically):
+ * whitespace.el (whitespace-help-on):
+ * vc-rcs.el (vc-rcs-consult-headers):
+ * userlock.el (ask-user-about-lock-help)
+ (ask-user-about-supersession-help):
+ * type-break.el (type-break-force-mode-line-update):
+ * time-stamp.el (time-stamp-conv-warn):
+ * terminal.el (te-set-output-log, te-more-break, te-filter)
+ (te-sentinel,terminal-emulator):
+ * term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
+ (term-write-input-ring, term-check-source, term-start-output-log):
+ (term-display-buffer-line, term-dynamic-list-completions):
+ (term-ansi-make-term, serial-term):
+ * subr.el (selective-display):
+ * strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
+ (strokes-encode-buffer, strokes-xpm-for-compressed-string):
+ * speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
+ (speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
+ (speedbar-remove-localized-speedbar-support)
+ (speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
+ (speedbar-update-special-contents, speedbar-buffer-buttons-engine)
+ (speedbar-buffers-line-directory):
+ * simple.el (shell-command-on-region, append-to-buffer)
+ (prepend-to-buffer):
+ * shadowfile.el (shadow-save-todo-file):
+ * scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
+ (scroll-bar-maybe-set-window-start):
+ * sb-image.el (speedbar-image-dump):
+ * saveplace.el (save-place-alist-to-file, save-places-to-alist)
+ (load-save-place-alist-from-file):
+ * ps-samp.el (ps-print-message-from-summary):
+ * ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
+ (ps-background-image, ps-begin-job, ps-do-despool):
+ * ps-bdf.el (bdf-find-file, bdf-read-font-info):
+ * printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
+ (pr-ps-message-from-summary, pr-lpr-message-from-summary):
+ (pr-call-process, pr-file-list, pr-interface-save):
+ * novice.el (disabled-command-function)
+ (enable-command, disable-command):
+ * mouse.el (mouse-buffer-menu-alist):
+ * mouse-copy.el (mouse-kill-preserving-secondary):
+ * macros.el (kbd-macro-query):
+ * ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
+ * informat.el (batch-info-validate):
+ * ido.el (ido-copy-current-word, ido-initiate-auto-merge):
+ * hippie-exp.el (try-expand-dabbrev-visible):
+ * help-mode.el (help-make-xrefs):
+ * help-fns.el (describe-variable):
+ * generic-x.el (bat-generic-mode-run-as-comint):
+ * finder.el (finder-mouse-select):
+ * find-dired.el (find-dired-sentinel):
+ * filesets.el (filesets-file-close):
+ * files.el (list-directory):
+ * faces.el (list-faces-display, describe-face):
+ * facemenu.el (list-colors-display):
+ * ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
+ * epg.el (epg--process-filter, epg-cancel):
+ * epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
+ (epa--read-signature-type):
+ * emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
+ (emerge-file-names):
+ * ehelp.el (electric-helpify):
+ * ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
+ * ediff-vers.el (rcs-ediff-view-revision):
+ * ediff-util.el (ediff-setup):
+ * ediff-mult.el (ediff-append-custom-diff):
+ * ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
+ (ediff-wordify):
+ * echistory.el (Electric-command-history-redo-expression):
+ * dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
+ * disp-table.el (describe-display-table):
+ * dired.el (dired-find-buffer-nocreate):
+ * dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
+ * dabbrev.el (dabbrev--same-major-mode-p):
+ * chistory.el (list-command-history):
+ * apropos.el (apropos-documentation):
+ * allout.el (allout-obtain-passphrase):
+ (allout-copy-exposed-to-buffer):
+ (allout-verify-passphrase): Use with-current-buffer.
+
2009-11-13 Glenn Morris <rgm@gnu.org>
* Makefile.in (ELCFILES): Regenerate.
2009-11-13 Michael Albinus <michael.albinus@gmx.de>
- * net/dbus.el (dbus-registered-objects-table): Renamed from
- `dbus-registered-functions-table', because it contains also
- properties.
+ * net/dbus.el (dbus-registered-objects-table): Rename from
+ `dbus-registered-functions-table', because it contains also properties.
(dbus-unregister-object): Unregister also properties.
(dbus-get-property, dbus-set-property, dbus-get-all-properties):
Use a timeout of 500 msec, in order to not block.
* custom.el (custom-declare-group): Purecopy standard-value.
(custom-declare-group): Purecopy custom-prefix.
- * international/mule.el (load-with-code-conversion): Call
- do-after-load-evaluation unconditionally.
+ * international/mule.el (load-with-code-conversion):
+ Call do-after-load-evaluation unconditionally.
* emacs-lisp/bytecomp.el (byte-compile-output-file-form): Handle defvaralias.
(goto-char beg)
(allout-topic-flat-index))
'(1))))
- (save-excursion (set-buffer tobuf)(erase-buffer))
+ (with-current-buffer tobuf (erase-buffer))
(allout-process-exposed 'allout-insert-listified
beg
end
;; Symmetric hereon:
- (save-excursion
- (set-buffer allout-buffer)
+ (with-current-buffer allout-buffer
(let* ((hint (if (and (not (string= allout-passphrase-hint-string ""))
(or (equal allout-passphrase-hint-handling 'always)
(and (equal allout-passphrase-hint-handling
"True if passphrase successfully decrypts verifier, nil otherwise.
\"Otherwise\" includes absence of passphrase verifier."
- (save-excursion
- (set-buffer allout-buffer)
+ (with-current-buffer allout-buffer
(and (boundp 'allout-passphrase-verifier-string)
allout-passphrase-verifier-string
(allout-encrypt-string (allout-get-encryption-passphrase-verifier)
(apropos-sort-by-scores apropos-documentation-sort-by-scores)
f v sf sv)
(unwind-protect
- (save-excursion
- (set-buffer standard-input)
+ (with-current-buffer standard-input
(apropos-documentation-check-doc-file)
(if do-all
(mapatoms
(prin1 (car history))
(terpri))
(setq history (cdr history))))
- (save-excursion
- (set-buffer "*Command History*")
+ (with-current-buffer "*Command History*"
(goto-char (point-min))
(if (eobp)
(error "No command history")
;; the article for expansion):
;; (set (make-local-variable 'dabbrev-friend-buffer-function)
;; (lambda (buffer)
-;; (save-excursion
-;; (set-buffer buffer)
+;; (with-current-buffer buffer
;; (memq major-mode '(news-reply-mode gnus-article-mode)))))
;;; Checks if OTHER-BUFFER has the same major mode as current buffer.
(defun dabbrev--same-major-mode-p (other-buffer)
(eq major-mode
- (save-excursion
- (set-buffer other-buffer)
+ (with-current-buffer other-buffer
major-mode)))
;;; Back over all abbrev type characters and then moves forward over
(let ((expanded-from-dir (expand-file-name from-dir))
(blist (buffer-list)))
(while blist
- (save-excursion
- (set-buffer (car blist))
+ (with-current-buffer (car blist)
(if (and buffer-file-name
(dired-in-this-tree buffer-file-name expanded-from-dir))
(let ((modflag (buffer-modified-p))
;; non-dired buffer may want to profit from this function, e.g. vm-uudecode
(if dired-dwim-target
(let* ((other-buf (window-buffer (next-window)))
- (other-dir (save-excursion
- (set-buffer other-buf)
+ (other-dir (with-current-buffer other-buf
(and (eq major-mode 'dired-mode)
(dired-current-directory)))))
(or other-dir this-dir))
(while blist
(if (null (buffer-name (cdr (car blist))))
(setq blist (cdr blist))
- (save-excursion
- (set-buffer (cdr (car blist)))
+ (with-current-buffer (cdr (car blist))
(if (and (eq major-mode mode)
dired-directory ;; nil during find-alternate-file
(equal dirname
(princ "\nVertical window border glyph: ")
(prin1 (display-table-slot dt 'vertical-border))
(princ "\nCharacter display glyph sequences:\n")
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(let ((vector (make-vector 256 nil))
(i 0))
(while (< i 256)
(find-file filename)))
(defun find-file-not-found-set-buffer-file-coding-system ()
- (save-excursion
- (set-buffer (current-buffer))
+ (with-current-buffer (current-buffer)
(let ((coding buffer-file-coding-system))
;; buffer-file-coding-system is already set by
;; find-operation-coding-system, which was called from
With prefix arg NOCONFIRM, execute current line as-is without editing."
(interactive "P")
(let (todo)
- (save-excursion
- (set-buffer "*Command History*")
+ (with-current-buffer "*Command History*"
(beginning-of-line)
(setq todo (read (current-buffer)))
(if (boundp 'electric-history-in-progress)
(unwind-protect
(let ((directory default-directory)
proc)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(erase-buffer)
(setq default-directory directory)
(if (or (memq system-type '(emx ms-dos windows-nt windows-95))
(if (and (memq (process-status process) '(exit signal))
(buffer-name (process-buffer process)))
(progn
- (save-excursion
- (set-buffer (process-buffer process))
+ (with-current-buffer (process-buffer process)
(setq mode-line-process nil))
(delete-process process))))
ediff-forward-word-function)
ediff-forward-word-function))
inbuf-syntax-tbl sv-point diff-string)
- (save-excursion
- (set-buffer in-buffer)
+ (with-current-buffer in-buffer
(setq inbuf-syntax-tbl
(if control-buf
(ediff-with-current-buffer control-buf
(cond ((ediff-buffer-live-p custom-diff-buf)
;; for live session buffers we do them first because the user may
;; have changed them with respect to the underlying files
- (save-excursion
- (set-buffer meta-diff-buff)
+ (with-current-buffer meta-diff-buff
(goto-char (point-max))
(insert-buffer-substring custom-diff-buf)
(insert "\n")))
ediff-merge-directories
ediff-merge-directories-with-ancestor))
;; get diffs by calling shell command on ediff-custom-diff-program
- (save-excursion
- (set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer)))
+ (with-current-buffer
+ (setq tmp-buf (get-buffer-create ediff-tmp-buffer))
(erase-buffer)
(shell-command
(format
)
t)
)
- (save-excursion
- (set-buffer meta-diff-buff)
+ (with-current-buffer meta-diff-buff
(goto-char (point-max))
(insert-buffer-substring tmp-buf)
(insert "\n")))
(setq buffer-C
(get-buffer-create
(ediff-unique-buffer-name "*ediff-merge" "*")))
- (save-excursion
- (set-buffer buffer-C)
+ (with-current-buffer buffer-C
(insert-buffer-substring buf)
(goto-char (point-min))
(funcall (ediff-with-current-buffer buf major-mode))
(fundamental-mode))
(let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
(delete-windows-on output-buffer)
- (save-excursion
- (set-buffer output-buffer)
+ (with-current-buffer output-buffer
(apply 'call-process "co" nil t nil
;; -q: quiet (no diagnostics)
(append switches rcs-default-co-switches
(buffer-B
(ediff-clone-buffer-for-region-comparison buffer-B "-Region.B-"))
reg-A-beg reg-A-end reg-B-beg reg-B-end)
- (save-excursion
- (set-buffer buffer-A)
+ (with-current-buffer buffer-A
(setq reg-A-beg (region-beginning)
reg-A-end (region-end))
(set-buffer buffer-B)
(buffer-B
(ediff-clone-buffer-for-region-comparison buffer-B "-Region.B-"))
reg-A-beg reg-A-end reg-B-beg reg-B-end)
- (save-excursion
- (set-buffer buffer-A)
+ (with-current-buffer buffer-A
(setq reg-A-beg (region-beginning)
reg-A-end (region-end))
;; enlarge the region to hold full lines
;;>> suspend updating of the tick in order to allow
;;>> things like momentary-string-display)
(and b
- (save-excursion
- (set-buffer b)
+ (with-current-buffer b
(set-buffer-modified-p t)))
(fset 'help-print-return-message 'ignore)
(call-interactively fun)
(not (buffer-modified-p b)))))
(fset 'help-print-return-message p)
(and b (buffer-name b)
- (save-excursion
- (set-buffer b)
+ (with-current-buffer b
(set-buffer-modified-p m))))))
(with-electric-help 'ignore name t))))
(A-end (1- (aref diff-vector 1)))
;; so further kills don't append
this-command)
- (save-excursion
- (set-buffer emerge-A-buffer)
+ (with-current-buffer emerge-A-buffer
(copy-region-as-kill A-begin A-end))))
(defun emerge-copy-as-kill-B ()
(B-end (1- (aref diff-vector 3)))
;; so further kills don't append
this-command)
- (save-excursion
- (set-buffer emerge-B-buffer)
+ (with-current-buffer emerge-B-buffer
(copy-region-as-kill B-begin B-end))))
(defun emerge-insert-A (arg)
(princ (buffer-name))))
(princ "\n")))
(princ emerge-output-description)
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode)))))
(defun emerge-join-differences (arg)
;; minor-mode indicator))
;; (princ (documentation minor-mode)))))
;; (setq minor-modes (cdr minor-modes))))
-;; (save-excursion
-;; (set-buffer standard-output)
+;; (with-current-buffer standard-output
;; (help-mode))
;; (help-print-return-message)))
(apply #'epa--list-keys epa-list-keys-arguments))
(defun epa--marked-keys ()
- (or (save-excursion
- (set-buffer epa-keys-buffer)
+ (or (with-current-buffer epa-keys-buffer
(goto-char (point-min))
(let (keys key)
(while (re-search-forward "^\\*" nil t)
(list key))))))
(defun epa--select-keys (prompt keys)
- (save-excursion
- (unless (and epa-keys-buffer
- (buffer-live-p epa-keys-buffer))
- (setq epa-keys-buffer (generate-new-buffer "*Keys*")))
- (set-buffer epa-keys-buffer)
+ (unless (and epa-keys-buffer
+ (buffer-live-p epa-keys-buffer))
+ (setq epa-keys-buffer (generate-new-buffer "*Keys*")))
+ (with-current-buffer epa-keys-buffer
(epa-key-list-mode)
(let ((inhibit-read-only t)
buffer-read-only)
(setq epa-info-buffer (generate-new-buffer "*Info*")))
(if (get-buffer-window epa-info-buffer)
(delete-window (get-buffer-window epa-info-buffer)))
- (save-excursion
- (set-buffer epa-info-buffer)
+ (with-current-buffer epa-info-buffer
(let ((inhibit-read-only t)
buffer-read-only)
(erase-buffer)
(setq type 'detached))
((eq c ??)
(with-output-to-temp-buffer "*Help*"
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(insert "\
n - Create a normal signature
c - Create a cleartext signature
(goto-char (point-max))
(insert input)))
(if (buffer-live-p (process-buffer process))
- (save-excursion
- (set-buffer (process-buffer process))
+ (with-current-buffer (process-buffer process)
(goto-char (point-max))
(insert input)
(unless epg-process-filter-running
(defun epg-cancel (context)
(if (buffer-live-p (process-buffer (epg-context-process context)))
- (save-excursion
- (set-buffer (process-buffer (epg-context-process context)))
+ (with-current-buffer (process-buffer (epg-context-process context))
(epg-context-set-result-for
epg-context 'error
(cons '(quit)
See `ezimage-expand-image-button-alist' for details."
(interactive)
(with-output-to-temp-buffer "*Ezimage Images*"
- (save-excursion
- (set-buffer "*Ezimage Images*")
+ (with-current-buffer "*Ezimage Images*"
(goto-char (point-max))
(insert "Ezimage image cache.\n\n")
(let ((start (point)) (end nil))
See `ezimage-expand-image-button-alist' for details."
(interactive)
(with-output-to-temp-buffer "*Ezimage Images*"
- (save-excursion
- (set-buffer "*Ezimage Images*")
+ (with-current-buffer "*Ezimage Images*"
(goto-char (point-max))
(insert "Ezimage image cache.\n\n")
(let ((start (point)) (end nil))
(if lc
(setcdr lc nil)))))
(with-help-window (or buffer-name "*Colors*")
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(setq truncate-lines t)
(if temp-buffer-show-function
(list-colors-print list)
(setq max-length (1+ max-length)
line-format (format "%%-%ds" max-length))
(with-help-window "*Faces*"
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(setq truncate-lines t)
(insert
(substitute-command-keys
(if (not (listp face))
(setq face (list face)))
(with-help-window (help-buffer)
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(dolist (f face)
(if (stringp f) (setq f (intern f)))
;; We may get called for anonymous faces (i.e., faces
(princ "Directory ")
(princ dirname)
(terpri)
- (save-excursion
- (set-buffer "*Directory*")
+ (with-current-buffer "*Directory*"
(let ((wildcard (not (file-directory-p dirname))))
(insert-directory dirname switches wildcard (not wildcard)))))
;; Finishing with-output-to-temp-buffer seems to clobber default-directory.
if `buffer-modified-p' returns nil.
SAVE-FUNCTION takes no argument, but works on the current buffer."
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(if (buffer-modified-p)
(funcall save-function))
(if (not (buffer-modified-p))
(let ((buf (process-buffer proc))
(inhibit-read-only t))
(if (buffer-name buf)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(let ((buffer-read-only nil))
(save-excursion
(goto-char (point-max))
(defun finder-mouse-select (event)
"Select item in a finder buffer with the mouse."
(interactive "e")
- (save-excursion
- (set-buffer (window-buffer (posn-window (event-start event))))
+ (with-current-buffer (window-buffer (posn-window (event-start event)))
(goto-char (posn-point (event-start event)))
(finder-select)))
(require 'comint)
(let* ((file (buffer-file-name))
(buf-name (concat "*" file "*")))
- (save-excursion
- (set-buffer
- (get-buffer-create buf-name))
+ (with-current-buffer (get-buffer-create buf-name)
(erase-buffer)
(comint-mode)
(comint-exec
(terpri)
(princ output))))
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
;; Return the text we displayed.
(buffer-string))))))))
help buffers. Variable `help-back-label' specifies the text for
that."
(interactive "b")
- (save-excursion
- (set-buffer (or buffer (current-buffer)))
+ (with-current-buffer (or buffer (current-buffer))
(goto-char (point-min))
;; Skip the header-type info, though it might be useful to parse
;; it at some stage (e.g. "function in `library'").
(while (and (not (equal he-search-string ""))
(marker-position he-search-loc)
(not expansion))
- (save-excursion
- (set-buffer (marker-buffer he-search-loc))
+ (with-current-buffer (marker-buffer he-search-loc)
(goto-char he-search-loc)
(setq expansion (he-dabbrev-search he-search-string ()
(window-end he-search-window)))
(defun ido-copy-current-word (all)
"Insert current word (file or directory name) from current buffer."
(interactive "P")
- (let ((word (save-excursion
- (set-buffer ido-entry-buffer)
+ (let ((word (with-current-buffer ido-entry-buffer
(let ((p (point)) start-line end-line start-name name)
(if (and mark-active (/= p (mark)))
(setq start-name (mark))
ido-text-init contents
ido-rotate-temp t
ido-exit 'refresh)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(ido-tidy))
(throw 'ido contents))))
nil ;(message "Checking validity of info file %s... OK" file)
(message "----------------------------------------------------------------------")
(message ">> PROBLEMS IN INFO FILE %s" file)
- (save-excursion
- (set-buffer loss-name)
+ (with-current-buffer loss-name
(princ (buffer-substring-no-properties
(point-min) (point-max))))
(message "----------------------------------------------------------------------")
(if ledit-save-files
(save-some-buffers))
(if (get-buffer ledit-buffer)
- (save-excursion
- (set-buffer ledit-buffer)
- (goto-char (point-min))
- (write-region (point-min) (point-max) ledit-zap-file)
- (erase-buffer)))
+ (with-current-buffer ledit-buffer
+ (goto-char (point-min))
+ (write-region (point-min) (point-max) ledit-zap-file)
+ (erase-buffer)))
(suspend-emacs ledit-go-to-lisp-string)
(load ledit-read-file t t))
(if ledit-save-files
(save-some-buffers))
(if (get-buffer ledit-buffer)
- (save-excursion
- (set-buffer ledit-buffer)
- (goto-char (point-min))
- (insert "(declare (macros t))\n")
- (write-region (point-min) (point-max) ledit-compile-file)
- (erase-buffer)))
+ (with-current-buffer ledit-buffer
+ (goto-char (point-min))
+ (insert "(declare (macros t))\n")
+ (write-region (point-min) (point-max) ledit-compile-file)
+ (erase-buffer)))
(suspend-emacs ledit-go-to-liszt-string)
(load ledit-read-file t t))
\\[exit] Stop the macro entirely right now.
\\[recenter] Redisplay the screen, then ask again.
\\[edit] Enter recursive edit; ask again when you exit from that."))
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode)))))))))))
;;;###autoload
;;nil means the buffer shouldn't be listed. You can redefine this."
;; (if (string-match "\\` " (buffer-name buffer))
;; nil
-;; (save-excursion
-;; (set-buffer buffer)
+;; (with-current-buffer buffer
;; (let ((size (buffer-size)))
;; (format "%s%s %-19s %6s %-15s %s"
;; (if (buffer-modified-p) "*" " ")
(window-buffer (posn-window (event-start click)))
(current-buffer)))
(error "Select or click on the buffer where the secondary selection is")))
- (save-excursion
- (set-buffer (overlay-buffer mouse-secondary-overlay))
+ (with-current-buffer (overlay-buffer mouse-secondary-overlay)
(kill-region (overlay-start mouse-secondary-overlay)
(overlay-end mouse-secondary-overlay)))
;; (delete-overlay mouse-secondary-overlay)
(format "%%-%ds %%s%%s %%s" maxlen)
(buffer-name elt)
(if (buffer-modified-p elt) "*" " ")
- (save-excursion
- (set-buffer elt)
+ (with-current-buffer elt
(if buffer-read-only "%" " "))
(or (buffer-file-name elt)
- (save-excursion
- (set-buffer elt)
+ (with-current-buffer elt
(if list-buffers-directory
(expand-file-name
list-buffers-directory)))
n to cancel--don't try the command, and it remains disabled.
SPC to try the command just this once, but leave it disabled.
! to try it, and enable all disabled commands for this session only.")
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode)))
(fit-window-to-buffer (get-buffer-window "*Disabled Command*"))
(message "Type y, n, ! or SPC (the space bar): ")
(eq system-type 'windows-nt)
(file-exists-p "~/_emacs"))
(setq init-file "~/_emacs")))
- (save-excursion
- (set-buffer (find-file-noselect
- (substitute-in-file-name init-file)))
+ (with-current-buffer (find-file-noselect
+ (substitute-in-file-name init-file))
(goto-char (point-min))
(if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
(delete-region
(eq system-type 'windows-nt)
(file-exists-p "~/_emacs"))
(setq init-file "~/_emacs")))
- (save-excursion
- (set-buffer (find-file-noselect
- (substitute-in-file-name init-file)))
+ (with-current-buffer (find-file-noselect
+ (substitute-in-file-name init-file))
(goto-char (point-min))
(if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
(delete-region
For more information, type \\[pr-interface-help]."
(interactive)
- (save-excursion
- (set-buffer (or buffer (current-buffer)))
+ (with-current-buffer (or buffer (current-buffer))
(pr-create-interface)))
(if (string= pr-ps-command "")
;; default action
(let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name)))
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(erase-buffer)
(insert-file-contents-literally file))
(pr-despool-print))
(symbol-value summary-buffer))
(symbol-value summary-default))))
(and (get-buffer buf)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(pr-mode-print n-up filename header-list)))))
(symbol-value summary-buffer))
(symbol-value summary-default))))
(and (get-buffer buf)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(pr-mode-lpr header-list)))))
status)
(setq args (pr-remove-nil-from-list args))
;; *Printing Command Output* == show command & args
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(goto-char (point-max))
(insert (format "%s %S\n" cmd args)))
;; *Printing Command Output* == show any return message from command
((quit error)
(error-message-string data)))))
;; *Printing Command Output* == show exit status
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(goto-char (point-max))
(insert (format "Exit status: %s\n\n" status)))
;; message if error status
(blist (buffer-list))
found)
(while (and (not found) blist)
- (save-excursion
- (set-buffer (car blist))
+ (with-current-buffer (car blist)
(and (eq major-mode 'dired-mode)
(save-excursion
(goto-char (point-min))
pop-up-frames)
(and (or buffer
(file-readable-p file))
- (save-excursion
- (set-buffer (or buffer
- (find-file-noselect file)))
+ (with-current-buffer (or buffer
+ (find-file-noselect file))
(funcall fun)
(or buffer
(kill-buffer (current-buffer))))))))
(defmacro pr-interface-save (&rest body)
- `(save-excursion
- (set-buffer pr-i-buffer)
+ `(with-current-buffer pr-i-buffer
,@body))
(and (file-readable-p bdfname)
(let ((buf (generate-new-buffer " *bdf-work*"))
(coding-system-for-read 'no-conversion))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert-file-contents bdfname)
buf))))
(message "Reading %s..." bdfname)
(error "BDF file %s doesn't exist" bdfname))
(unwind-protect
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(goto-char (point-min))
(search-forward "\nFONTBOUNDINGBOX")
(setq font-bounding-box
(ps-output 'prologue (if (stringp args) (list args) args)))
(defun ps-flush-output ()
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(goto-char (point-max))
(while ps-output-head
(let ((it (car ps-output-head)))
(defun ps-insert-file (fname)
(ps-flush-output)
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(goto-char (point-max))
(insert-file-contents fname)))
(defun ps-get-boundingbox ()
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(save-excursion
(if (re-search-forward ps-boundingbox-re nil t)
(vector (string-to-number ; lower x
;; coordinate adjustment to center image
;; around x and y position
(let ((box (ps-get-boundingbox)))
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(save-excursion
(if (re-search-backward "^--back--" nil t)
(replace-match
ps-line-number-step
ps-zebra-stripe-height))))
;; spooling buffer
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(goto-char (point-max))
(and (re-search-backward "^%%Trailer$" nil t)
(delete-region (match-beginning 0) (point-max))))
(and ps-razzle-dazzle (message "Wrote %s" filename)))
;; Else, spool to the printer
(and ps-razzle-dazzle (message "Printing..."))
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(let* ((coding-system-for-write 'raw-text-unix)
(ps-printer-name (or ps-printer-name
(and (boundp 'printer-name)
(symbol-value summary-buffer))
summary-default)))
(and (get-buffer ps-buf)
- (save-excursion
- (set-buffer ps-buf)
+ (with-current-buffer ps-buf
(ps-spool-buffer-with-faces)))))
;; Look in an article or mail message for the Subject: line. To be
(defun save-place-alist-to-file ()
(let ((file (expand-file-name save-place-file))
(coding-system-for-write 'utf-8))
- (save-excursion
- (set-buffer (get-buffer-create " *Saved Places*"))
+ (with-current-buffer (get-buffer-create " *Saved Places*")
(delete-region (point-min) (point-max))
(when save-place-forget-unreadable-files
(save-place-forget-unreadable-files))
;; make sure that the alist does not get overwritten, and then
;; load it if it exists:
(if (file-readable-p file)
- (save-excursion
- ;; don't want to use find-file because we have been
- ;; adding hooks to it.
- (set-buffer (get-buffer-create " *Saved Places*"))
+ ;; don't want to use find-file because we have been
+ ;; adding hooks to it.
+ (with-current-buffer (get-buffer-create " *Saved Places*")
(delete-region (point-min) (point-max))
(insert-file-contents file)
(goto-char (point-min))
;; put this into a save-excursion in case someone is counting on
;; another function in kill-emacs-hook to act on the last buffer
;; they were in:
- (save-excursion
- (set-buffer (car buf-list))
+ (with-current-buffer (car buf-list)
;; save-place checks buffer-file-name too, but we can avoid
;; overhead of function call by checking here too.
(and buffer-file-name (save-place-to-alist))
See `speedbar-expand-image-button-alist' for details."
(interactive)
(with-output-to-temp-buffer "*Speedbar Images*"
- (save-excursion
- (set-buffer "*Speedbar Images*")
+ (with-current-buffer "*Speedbar Images*"
(goto-char (point-max))
(insert "Speedbar image cache.\n\n")
(let ((start (point)) (end nil))
\f
;;;; Buffer navigation using the scroll bar.
-;;; This was used for up-events on button 2, but no longer.
+;; This was used for up-events on button 2, but no longer.
(defun scroll-bar-set-window-start (event)
"Set the window start according to where the scroll bar is dragged.
EVENT should be a scroll bar click or drag event."
(let* ((end-position (event-end event))
(window (nth 0 end-position))
(portion-whole (nth 2 end-position)))
- (save-excursion
- (set-buffer (window-buffer window))
+ (with-current-buffer (window-buffer window)
(save-excursion
(goto-char (+ (point-min)
(scroll-bar-scale portion-whole
portion-start
next-portion-start
(current-start (window-start window)))
- (save-excursion
- (set-buffer (window-buffer window))
+ (with-current-buffer (window-buffer window)
(setq portion-start (scroll-bar-drag-position portion-whole))
(setq next-portion-start (max
(scroll-bar-drag-position next-portion-whole)
(let* ((start-position (event-start event))
(window (nth 0 start-position))
(portion-whole (nth 2 start-position)))
- (save-excursion
- (set-buffer (window-buffer window))
+ (with-current-buffer (window-buffer window)
;; Calculate position relative to the accessible part of the buffer.
(goto-char (+ (point-min)
(scroll-bar-scale portion-whole
\f
;;;; Bindings.
-;;; For now, we'll set things up to work like xterm.
+;; For now, we'll set things up to work like xterm.
(cond ((and (boundp 'x-toolkit-scroll-bars) x-toolkit-scroll-bars)
(global-set-key [vertical-scroll-bar mouse-1]
'scroll-bar-toolkit-scroll))
(defun shadow-save-todo-file ()
(if (and shadow-todo-buffer (buffer-modified-p shadow-todo-buffer))
- (save-excursion
- (set-buffer shadow-todo-buffer)
+ (with-current-buffer shadow-todo-buffer
(condition-case nil ; have to continue even in case of
(basic-save-buffer) ; error, otherwise kill-emacs might
(error ; not work!
;; Clear the output buffer, then run the command with
;; output there.
(let ((directory default-directory))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(setq buffer-read-only nil)
(if (not output-buffer)
(setq default-directory directory))
(list (read-buffer "Append to buffer: " (other-buffer (current-buffer) t))
(region-beginning) (region-end)))
(let ((oldbuf (current-buffer)))
- (save-excursion
- (let* ((append-to (get-buffer-create buffer))
- (windows (get-buffer-window-list append-to t t))
- point)
- (set-buffer append-to)
+ (let* ((append-to (get-buffer-create buffer))
+ (windows (get-buffer-window-list append-to t t))
+ point)
+ (with-current-buffer append-to
(setq point (point))
(barf-if-buffer-read-only)
(insert-buffer-substring oldbuf start end)
START and END specify the portion of the current buffer to be copied."
(interactive "BPrepend to buffer: \nr")
(let ((oldbuf (current-buffer)))
- (save-excursion
- (set-buffer (get-buffer-create buffer))
+ (with-current-buffer (get-buffer-create buffer)
(barf-if-buffer-read-only)
(save-excursion
(insert-buffer-substring oldbuf start end)))))
(with-no-warnings
(specifier-instance has-modeline-p)))
speedbar-buffer)
- (save-excursion
- (set-buffer speedbar-buffer)
+ (with-current-buffer speedbar-buffer
(let* ((w (or (speedbar-frame-width) 20))
(p1 "<<")
(p5 ">>")
(current-buffer))
speedbar-special-mode-key-map)
(select-frame cf))))))
- (save-excursion
- (set-buffer speedbar-buffer)
+ (with-current-buffer speedbar-buffer
(use-local-map (or localmap
(speedbar-initial-keymap)
;; This creates a small keymap we can glom the
(if (stringp buffer) (setq buffer (get-buffer buffer)))
(if (not (buffer-live-p buffer))
nil
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(save-match-data
(let ((ms (symbol-name major-mode)) v)
(if (not (string-match "-mode$" ms))
(defun speedbar-remove-localized-speedbar-support (buffer)
"Remove any traces that BUFFER supports speedbar in a specialized way."
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(kill-local-variable 'speedbar-special-mode-expansion-list)
(kill-local-variable 'speedbar-special-mode-key-map)
(kill-local-variable 'speedbar-easymenu-definition-special)))
(or (speedbar-line-file)
(speedbar-line-directory))))
(methods (if (get-file-buffer f)
- (save-excursion (set-buffer (get-file-buffer f))
- speedbar-tag-hierarchy-method)
+ (with-current-buffer (get-file-buffer f)
+ speedbar-tag-hierarchy-method)
speedbar-tag-hierarchy-method))
(lst (if (fboundp 'copy-tree)
(copy-tree lst)
This should only be used by modes classified as special."
(let ((funclst speedbar-special-mode-expansion-list)
(specialbuff (current-buffer)))
- (save-excursion
- (setq speedbar-desired-buffer specialbuff)
- (set-buffer speedbar-buffer)
+ (setq speedbar-desired-buffer specialbuff)
+ (with-current-buffer speedbar-buffer
;; If we are leaving a directory, cache it.
(if (not speedbar-shown-directories)
;; Do nothing
(buffer-name (car bl))))
(expchar (if known ?+ ??))
(fn (if known 'speedbar-tag-file nil))
- (fname (save-excursion (set-buffer (car bl))
- (buffer-file-name))))
+ (fname (with-current-buffer (car bl)
+ (buffer-file-name))))
(speedbar-make-tag-line 'bracket expchar fn
(if fname (file-name-nondirectory fname))
(buffer-name (car bl))
"Add a note to the end of the last tag line.
Argument BUFFER is the buffer being tested."
(let (mod ro)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(setq mod (buffer-modified-p)
ro buffer-read-only))
(if ro (speedbar-insert-button "%" nil nil nil nil t))))
(speedbar-message "%s%s %S %d %s"
(if (buffer-modified-p buffer) "* " "")
item
- (save-excursion (set-buffer buffer) major-mode)
- (save-excursion (set-buffer buffer)
- (buffer-size))
+ (with-current-buffer buffer major-mode)
+ (with-current-buffer buffer (buffer-size))
(or (buffer-file-name buffer) "<No file>"))))))
(defun speedbar-buffers-line-directory (&optional depth)
(if (save-excursion
(end-of-line)
(eq start (point)))
- (or (save-excursion (set-buffer buffer)
- default-directory)
+ (or (with-current-buffer buffer default-directory)
"")
(buffer-file-name buffer))))))))
(defun strokes-xpm-to-compressed-string (&optional xpm-buffer)
"Convert XPM in XPM-BUFFER to compressed string representing the stroke.
XPM-BUFFER defaults to ` *strokes-xpm*'."
- (save-excursion
- (set-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*")))
+ (with-current-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*"))
(goto-char (point-min))
(search-forward "/* pixels */") ; skip past header junk
(forward-char 2)
Optional FORCE non-nil will ignore the buffer's read-only status."
(interactive)
;; (interactive "*bStrokify buffer: ")
- (save-excursion
- (set-buffer (setq buffer (get-buffer (or buffer (current-buffer)))))
+ (with-current-buffer (setq buffer (get-buffer (or buffer (current-buffer))))
(when (or (not buffer-read-only)
force
inhibit-read-only
;; buffer is killed?
;; (interactive "*bUnstrokify buffer: ")
(interactive)
- (save-excursion
- (set-buffer (setq buffer (or buffer (current-buffer))))
+ (with-current-buffer (setq buffer (or buffer (current-buffer)))
(when (or (not buffer-read-only)
force
inhibit-read-only
(defun strokes-xpm-for-compressed-string (compressed-string &optional bufname)
"Convert the stroke represented by COMPRESSED-STRING into an XPM.
Store XPM in buffer BUFNAME if supplied \(default is ` *strokes-xpm*'\)"
- (save-excursion
- (or bufname (setq bufname " *strokes-xpm*"))
- (set-buffer (get-buffer-create bufname))
+ (or bufname (setq bufname " *strokes-xpm*"))
+ (with-current-buffer (get-buffer-create bufname)
(erase-buffer)
(insert compressed-string)
(goto-char (point-min))
;; If no process, or nuked process, crank up a new one and put buffer in
;; term mode. Otherwise, leave buffer and existing process alone.
(cond ((not (term-check-proc buffer))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(term-mode)) ; Install local vars, mode, keymap, ...
(term-exec buffer name program startfile switches)))
buffer))
Blasts any old process running in the buffer. Doesn't set the buffer mode.
You can use this to cheaply run a series of processes in the same term
buffer. The hook `term-exec-hook' is run after each exec."
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(let ((proc (get-buffer-process buffer))) ; Blast any old process.
(when proc (delete-process proc)))
;; Crank up a new process
(if (null (buffer-name buffer))
;; buffer killed
(set-process-buffer proc nil)
- (let ((obuf (current-buffer)))
- ;; save-excursion isn't the right thing if
- ;; process-buffer is current-buffer
- (unwind-protect
- (progn
- ;; Write something in the compilation buffer
- ;; and hack its mode line.
- (set-buffer buffer)
- ;; Get rid of local keymap.
- (use-local-map nil)
- (term-handle-exit (process-name proc)
- msg)
- ;; Since the buffer and mode line will show that the
- ;; process is dead, we can delete it now. Otherwise it
- ;; will stay around until M-x list-processes.
- (delete-process proc))
- (set-buffer obuf)))
- ))))
+ (with-current-buffer buffer
+ ;; Write something in the compilation buffer
+ ;; and hack its mode line.
+ ;; Get rid of local keymap.
+ (use-local-map nil)
+ (term-handle-exit (process-name proc) msg)
+ ;; Since the buffer and mode line will show that the
+ ;; process is dead, we can delete it now. Otherwise it
+ ;; will stay around until M-x list-processes.
+ (delete-process proc))))))
(defun term-handle-exit (process-name msg)
"Write process exit (or other change) message MSG in the current buffer."
(count 0)
(ring (make-ring term-input-ring-size)))
(unwind-protect
- (save-excursion
- (set-buffer history-buf)
+ (with-current-buffer history-buf
(widen)
(erase-buffer)
(insert-file-contents file)
(index (ring-length ring)))
;; Write it all out into a buffer first. Much faster, but messier,
;; than writing it one line at a time.
- (save-excursion
- (set-buffer history-buf)
+ (with-current-buffer history-buf
(erase-buffer)
(while (> index 0)
(setq index (1- index))
(y-or-n-p (format "Save buffer %s first? "
(buffer-name buff))))
;; save BUFF.
- (let ((old-buffer (current-buffer)))
- (set-buffer buff)
- (save-buffer)
- (set-buffer old-buffer)))))
+ (with-current-buffer buff
+ (save-buffer)))))
;; (TERM-GET-SOURCE prompt prev-dir/file source-modes mustmatch-p)
(defun term-display-buffer-line (buffer line)
(let* ((window (display-buffer buffer t))
(pos))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(save-restriction
(widen)
(goto-char (point-min))
(message "Output logging off."))
(if (get-buffer name)
nil
- (save-excursion
- (set-buffer (get-buffer-create name))
+ (with-current-buffer (get-buffer-create name)
(fundamental-mode)
(buffer-disable-undo (current-buffer))
(erase-buffer)))
(display-completion-list (sort completions 'string-lessp)))
(message "Hit space to flush")
(let (key first)
- (if (save-excursion
- (set-buffer (get-buffer "*Completions*"))
+ (if (with-current-buffer (get-buffer "*Completions*")
(setq key (read-key-sequence nil)
first (aref key 0))
(and (consp first)
;; If no process, or nuked process, crank up a new one and put buffer in
;; term mode. Otherwise, leave buffer and existing process alone.
(cond ((not (term-check-proc buffer))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(term-mode)) ; Install local vars, mode, keymap, ...
(term-exec buffer name program startfile switches)))
buffer))
:coding 'no-conversion
:noquery t))
(buffer (process-buffer process)))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(term-mode)
(term-char-mode)
(goto-char (point-max))
(message "Output logging off."))
(if (get-buffer name)
nil
- (save-excursion
- (set-buffer (get-buffer-create name))
+ (with-current-buffer (get-buffer-create name)
(fundamental-mode)
(buffer-disable-undo (current-buffer))
(erase-buffer)))
"%-"))
(set-process-filter te-process
(function (lambda (process string)
- (save-excursion
- (set-buffer (process-buffer process))
+ (with-current-buffer (process-buffer process)
(setq te-pending-output (nconc te-pending-output
(list string))))
(te-update-pending-output-display))))
\f
(defun te-filter (process string)
- (let* ((obuf (current-buffer)))
- ;; can't use save-excursion, as that preserves point, which we don't want
- (unwind-protect
- (progn
- (set-buffer (process-buffer process))
- (goto-char te-saved-point)
- (and (bufferp te-log-buffer)
- (if (null (buffer-name te-log-buffer))
- ;; killed
- (setq te-log-buffer nil)
- (set-buffer te-log-buffer)
- (goto-char (point-max))
- (insert-before-markers string)
- (set-buffer (process-buffer process))))
- (setq te-pending-output (nconc te-pending-output (list string)))
- (te-update-pending-output-display)
- (te-process-output (eq (current-buffer)
- (window-buffer (selected-window))))
- (set-buffer (process-buffer process))
- (setq te-saved-point (point)))
- (set-buffer obuf))))
+ (with-current-buffer (process-buffer process)
+ (goto-char te-saved-point)
+ (and (bufferp te-log-buffer)
+ (if (null (buffer-name te-log-buffer))
+ ;; killed
+ (setq te-log-buffer nil)
+ (set-buffer te-log-buffer)
+ (goto-char (point-max))
+ (insert-before-markers string)
+ (set-buffer (process-buffer process))))
+ (setq te-pending-output (nconc te-pending-output (list string)))
+ (te-update-pending-output-display)
+ (te-process-output (eq (current-buffer)
+ (window-buffer (selected-window))))
+ (set-buffer (process-buffer process))
+ (setq te-saved-point (point))))
;; (A version of the following comment which might be distractingly offensive
;; to some readers has been moved to term-nasty.el.)
(cond ((eq (process-status process) 'run))
((null (buffer-name (process-buffer process)))) ;deleted
(t (let ((b (current-buffer)))
- (save-excursion
- (set-buffer (process-buffer process))
+ (with-current-buffer (process-buffer process)
(setq buffer-read-only nil)
(fundamental-mode)
(goto-char (point-max))
and is non-nil after the terminal buffer has been set up and the
subprocess started."
(interactive
- (cons (save-excursion
- (set-buffer (get-buffer-create "*terminal*"))
- (buffer-name (if (or (not (boundp 'te-process))
- (null te-process)
- (not (eq (process-status te-process)
- 'run)))
- (current-buffer)
- (generate-new-buffer "*terminal*"))))
- (append
- (let* ((default-s
- ;; Default shell is same thing M-x shell uses.
- (or explicit-shell-file-name
- (getenv "ESHELL")
- (getenv "SHELL")
- "/bin/sh"))
- (s (read-string
- (format "Run program in emulator (default %s): "
- default-s))))
- (if (equal s "")
- (list default-s '())
- (te-parse-program-and-args s))))))
+ (cons (with-current-buffer (get-buffer-create "*terminal*")
+ (buffer-name (if (or (not (boundp 'te-process))
+ (null te-process)
+ (not (eq (process-status te-process)
+ 'run)))
+ (current-buffer)
+ (generate-new-buffer "*terminal*"))))
+ (append
+ (let* ((default-s
+ ;; Default shell is same thing M-x shell uses.
+ (or explicit-shell-file-name
+ (getenv "ESHELL")
+ (getenv "SHELL")
+ "/bin/sh"))
+ (s (read-string
+ (format "Run program in emulator (default %s): "
+ default-s))))
+ (if (equal s "")
+ (list default-s '())
+ (te-parse-program-and-args s))))))
(switch-to-buffer buffer)
(if (null width) (setq width (- (window-width (selected-window)) 1)))
(if (null height) (setq height (- (window-height (selected-window)) 1)))
Suggests replacing OLD-FORM with NEW-FORM."
(cond
(time-stamp-conversion-warn
- (save-excursion
- (set-buffer (get-buffer-create "*Time-stamp-compatibility*"))
+ (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*")
(goto-char (point-max))
(if (bobp)
(progn
(defun type-break-force-mode-line-update (&optional all)
"Force the mode-line of the current buffer to be redisplayed.
With optional non-nil ALL, force redisplay of all mode-lines."
- (and all (save-excursion (set-buffer (other-buffer))))
+ (and all (with-current-buffer (other-buffer)))
(set-buffer-modified-p (buffer-modified-p)))
;; If an exception occurs in Emacs while running the post command hook, the
\f
;;; Timer wrapper functions
-;;;
-;;; These shield type-break from variations in the interval timer packages
-;;; for different versions of Emacs.
+;;
+;; These shield type-break from variations in the interval timer packages
+;; for different versions of Emacs.
(defun type-break-run-at-time (time repeat function)
(condition-case nil (or (require 'timer) (require 'itimer)) (error nil))
intruder if (s)he ever unmodifies the file and then changes it again.
You can <p>roceed; you edit at your own (and the other user's) risk.
You can <q>uit; don't modify this file.")
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode))))
(put
Usually, you should type `n' and then `M-x revert-buffer',
to get the latest version of the file, then make the change again.")
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode))))
;; arch-tag: a61c5b60-e1c8-44fd-894a-c617f4dfc639
(cond
((not (get-file-buffer file)) nil)
((let (status version locking-user)
- (save-excursion
- (set-buffer (get-file-buffer file))
- (goto-char (point-min))
- (cond
- ;; search for $Id or $Header
- ;; -------------------------
- ;; The `\ 's below avoid an RCS 5.7 bug when checking in this file.
- ((or (and (search-forward "$Id\ : " nil t)
- (looking-at "[^ ]+ \\([0-9.]+\\) "))
- (and (progn (goto-char (point-min))
- (search-forward "$Header\ : " nil t))
- (looking-at "[^ ]+ \\([0-9.]+\\) ")))
- (goto-char (match-end 0))
- ;; if found, store the revision number ...
- (setq version (match-string-no-properties 1))
- ;; ... and check for the locking state
- (cond
- ((looking-at
- (concat "[0-9]+[/-][01][0-9][/-][0-3][0-9] " ; date
- "[0-2][0-9]:[0-5][0-9]+:[0-6][0-9]+\\([+-][0-9:]+\\)? " ; time
- "[^ ]+ [^ ]+ ")) ; author & state
- (goto-char (match-end 0)) ; [0-6] in regexp handles leap seconds
- (cond
- ;; unlocked revision
- ((looking-at "\\$")
- (setq locking-user 'none)
- (setq status 'rev-and-lock))
- ;; revision is locked by some user
- ((looking-at "\\([^ ]+\\) \\$")
- (setq locking-user (match-string-no-properties 1))
- (setq status 'rev-and-lock))
- ;; everything else: false
- (nil)))
- ;; unexpected information in
- ;; keyword string --> quit
- (nil)))
- ;; search for $Revision
- ;; --------------------
- ((re-search-forward (concat "\\$"
- "Revision: \\([0-9.]+\\) \\$")
- nil t)
- ;; if found, store the revision number ...
- (setq version (match-string-no-properties 1))
- ;; and see if there's any lock information
- (goto-char (point-min))
- (if (re-search-forward (concat "\\$" "Locker:") nil t)
- (cond ((looking-at " \\([^ ]+\\) \\$")
- (setq locking-user (match-string-no-properties 1))
- (setq status 'rev-and-lock))
- ((looking-at " *\\$")
- (setq locking-user 'none)
- (setq status 'rev-and-lock))
- (t
- (setq locking-user 'none)
- (setq status 'rev-and-lock)))
- (setq status 'rev)))
- ;; else: nothing found
- ;; -------------------
- (t nil)))
+ (with-current-buffer (get-file-buffer file)
+ (goto-char (point-min))
+ (cond
+ ;; search for $Id or $Header
+ ;; -------------------------
+ ;; The `\ 's below avoid an RCS 5.7 bug when checking in this file.
+ ((or (and (search-forward "$Id\ : " nil t)
+ (looking-at "[^ ]+ \\([0-9.]+\\) "))
+ (and (progn (goto-char (point-min))
+ (search-forward "$Header\ : " nil t))
+ (looking-at "[^ ]+ \\([0-9.]+\\) ")))
+ (goto-char (match-end 0))
+ ;; if found, store the revision number ...
+ (setq version (match-string-no-properties 1))
+ ;; ... and check for the locking state
+ (cond
+ ((looking-at
+ (concat "[0-9]+[/-][01][0-9][/-][0-3][0-9] " ; date
+ "[0-2][0-9]:[0-5][0-9]+:[0-6][0-9]+\\([+-][0-9:]+\\)? " ; time
+ "[^ ]+ [^ ]+ ")) ; author & state
+ (goto-char (match-end 0)) ; [0-6] in regexp handles leap seconds
+ (cond
+ ;; unlocked revision
+ ((looking-at "\\$")
+ (setq locking-user 'none)
+ (setq status 'rev-and-lock))
+ ;; revision is locked by some user
+ ((looking-at "\\([^ ]+\\) \\$")
+ (setq locking-user (match-string-no-properties 1))
+ (setq status 'rev-and-lock))
+ ;; everything else: false
+ (nil)))
+ ;; unexpected information in
+ ;; keyword string --> quit
+ (nil)))
+ ;; search for $Revision
+ ;; --------------------
+ ((re-search-forward (concat "\\$"
+ "Revision: \\([0-9.]+\\) \\$")
+ nil t)
+ ;; if found, store the revision number ...
+ (setq version (match-string-no-properties 1))
+ ;; and see if there's any lock information
+ (goto-char (point-min))
+ (if (re-search-forward (concat "\\$" "Locker:") nil t)
+ (cond ((looking-at " \\([^ ]+\\) \\$")
+ (setq locking-user (match-string-no-properties 1))
+ (setq status 'rev-and-lock))
+ ((looking-at " *\\$")
+ (setq locking-user 'none)
+ (setq status 'rev-and-lock))
+ (t
+ (setq locking-user 'none)
+ (setq status 'rev-and-lock)))
+ (setq status 'rev)))
+ ;; else: nothing found
+ ;; -------------------
+ (t nil)))
(if status (vc-file-setprop file 'vc-working-revision version))
(and (eq status 'rev-and-lock)
(vc-file-setprop file 'vc-state
(unless (get-buffer whitespace-help-buffer-name)
(delete-other-windows)
(let ((buffer (get-buffer-create whitespace-help-buffer-name)))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(erase-buffer)
(insert whitespace-help-text)
(whitespace-insert-option-mark
(setq size (+ (window-height) size)))
(setq new-window (split-window nil size))
(unless split-window-keep-point
- (save-excursion
- (set-buffer (window-buffer))
+ (with-current-buffer (window-buffer)
(goto-char (window-start))
(setq moved (vertical-motion (window-height)))
(set-window-start new-window (point))
(let ((buffer (when (window-live-p window)
(window-buffer window)))
(current-state (x-dnd-get-state-for-frame window)))
- (when (or (not (equal buffer (aref current-state 0)))
- (not (equal window (aref current-state 1)))
- (not (equal action (aref current-state 3))))
- (save-excursion
+ (unless (and (equal buffer (aref current-state 0))
+ (equal window (aref current-state 1))
+ (equal action (aref current-state 3)))
+ (save-current-buffer
(when buffer (set-buffer buffer))
(let* ((action-type (funcall x-dnd-test-function
window