1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-25 10:47:00 +00:00

(do-auto-fill): Remove unused vars bol' and opoint'.

(completion-setup-function): Use with-current-buffer.
Properly save excursion.  Simplify.
Don't assume there is necessarily a `mouse-face' property somewhere.
This commit is contained in:
Stefan Monnier 2004-05-19 19:10:19 +00:00
parent f0975dfd6c
commit 621a3f6266

View File

@ -3392,15 +3392,14 @@ Setting this variable automatically makes it local to the current buffer.")
;; (Actually some major modes use a different auto-fill function,
;; but this one is the default one.)
(defun do-auto-fill ()
(let (fc justify bol give-up
(let (fc justify give-up
(fill-prefix fill-prefix))
(if (or (not (setq justify (current-justification)))
(null (setq fc (current-fill-column)))
(and (eq justify 'left)
(<= (current-column) fc))
(save-excursion (beginning-of-line)
(setq bol (point))
(and auto-fill-inhibit-regexp
(save-excursion (beginning-of-line)
(looking-at auto-fill-inhibit-regexp))))
nil ;; Auto-filling not required
(if (memq justify '(full center right))
@ -3423,7 +3422,6 @@ Setting this variable automatically makes it local to the current buffer.")
;; Determine where to split the line.
(let* (after-prefix
(fill-point
(let ((opoint (point)))
(save-excursion
(beginning-of-line)
(setq after-prefix (point))
@ -3432,7 +3430,7 @@ Setting this variable automatically makes it local to the current buffer.")
(setq after-prefix (match-end 0)))
(move-to-column (1+ fc))
(fill-move-to-break-point after-prefix)
(point)))))
(point))))
;; See whether the place we found is any good.
(if (save-excursion
@ -4265,7 +4263,6 @@ of the differing parts is, by contrast, slightly highlighted."
:group 'completion)
(defun completion-setup-function ()
(save-excursion
(let ((mainbuf (current-buffer))
(mbuf-contents (minibuffer-contents)))
;; When reading a file name in the minibuffer,
@ -4274,7 +4271,7 @@ of the differing parts is, by contrast, slightly highlighted."
(if minibuffer-completing-file-name
(with-current-buffer mainbuf
(setq default-directory (file-name-directory mbuf-contents))))
(set-buffer standard-output)
(with-current-buffer standard-output
(completion-list-mode)
(make-local-variable 'completion-reference-buffer)
(setq completion-reference-buffer mainbuf)
@ -4283,24 +4280,23 @@ of the differing parts is, by contrast, slightly highlighted."
;; use the number of chars before the start of the
;; last file name component.
(setq completion-base-size
(with-current-buffer mainbuf
(save-excursion
(set-buffer mainbuf)
(goto-char (point-max))
(skip-chars-backward "^/")
(- (point) (minibuffer-prompt-end))))
(- (point) (minibuffer-prompt-end)))))
;; Otherwise, in minibuffer, the whole input is being completed.
(save-match-data
(if (minibufferp mainbuf)
(setq completion-base-size 0))))
(setq completion-base-size 0)))
;; Put faces on first uncommon characters and common parts.
(when completion-base-size
(let* ((common-string-length (length
(substring mbuf-contents
completion-base-size)))
(let* ((common-string-length
(- (length mbuf-contents) completion-base-size))
(element-start (next-single-property-change
(point-min)
'mouse-face))
(element-common-end (+ element-start common-string-length))
(element-common-end
(+ (or element-start nil) common-string-length))
(maxp (point-max)))
(while (and element-start (< element-common-end maxp))
(when (and (get-char-property element-start 'mouse-face)
@ -4764,5 +4760,5 @@ works by saving the value of `buffer-invisibility-spec' and setting it to nil."
(provide 'simple)
;;; arch-tag: 24af67c0-2a49-44f6-b3b1-312d8b570dfd
;; arch-tag: 24af67c0-2a49-44f6-b3b1-312d8b570dfd
;;; simple.el ends here