(interactive)
(if (PC-was-meta-key)
(minibuffer-complete)
- (PC-do-completion nil)))
+ ;; If the previous command was not this one,
+ ;; never scroll, always retry completion.
+ (or (eq last-command this-command)
+ (setq minibuffer-scroll-window nil))
+ (let ((window minibuffer-scroll-window))
+ ;; If there's a fresh completion window with a live buffer,
+ ;; and this command is repeated, scroll that window.
+ (if (and window (window-buffer window)
+ (buffer-name (window-buffer window)))
+ (save-excursion
+ (set-buffer (window-buffer window))
+ (if (pos-visible-in-window-p (point-max) window)
+ (set-window-start window (point-min) nil)
+ (scroll-other-window)))
+ (PC-do-completion nil)))))
(defun PC-complete-word ()
(setq p compl)
(while p
(and (string-match regex (car p))
- (setq poss (cons (car p) poss)))
+ (progn
+ (set-text-properties 0 (length (car p)) '() (car p))
+ (setq poss (cons (car p) poss))))
(setq p (cdr p)))))
;; Now we have a list of possible completions
;; Is the actual string one of the possible completions?
(setq p (and (not (eq mode 'help)) poss))
(while (and p
- (not (equal (car p) basestr)))
+ (not (string-equal (car p) basestr)))
(setq p (cdr p)))
(and p (null mode)
(PC-temp-minibuffer-message " [Complete, but not unique]"))
(delete-char 1)
(setq end (1- end))))
(setq improved t))
- ;; Use format to discard text properties.
- (insert (format "%s" (substring prefix i (1+ i))))
+ (insert (substring prefix i (1+ i)))
(setq end (1+ end)))
(setq i (1+ i)))
(or pt (equal (point) beg)
(kill-buffer (current-buffer))
(or files
(error "No matching files"))
+ ;; Bring the other files (not the first) into buffers.
(save-window-excursion
(while (setq next (cdr next))
(let ((buf (find-file-noselect (car next))))
+ ;; Put this buffer at the front of the buffer list.
(switch-to-buffer buf))))
- ;; This modifies the "buf" variable inside find-file-noselect.
+ ;; This modifies the `buf' variable inside find-file-noselect.
(setq buf (get-file-buffer first))
(if buf
nil ; should do verify-visited-file-modtime stuff.
(setq filename first)
(setq buf (create-file-buffer filename))
+ ;; This modified `truename' inside find-file-noselect.
+ (setq truename (abbreviate-file-name (file-truename filename)))
(set-buffer buf)
(erase-buffer)
(insert-file-contents filename t))