From 50be475d120ff32d4ff3ab3d3497d4156cf7d480 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 30 May 1997 00:58:54 +0000 Subject: [PATCH] (line-move): If moving into intangible text, try to move to the end of the intangible segment if it's on that line. (completion-setup-function): Do set completion-base-size. (do-auto-fill): Don't give fill-context-prefix a third arg. --- lisp/simple.el | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 74280ab8f93..c26e7dcc8fa 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1943,11 +1943,26 @@ Outline mode sets this." (setq arg (1+ arg)))) (let ((buffer-invisibility-spec nil)) (move-to-column (or goal-column temporary-goal-column)))) + (setq new (point)) + ;; If we are moving into some intangible text, + ;; look for following text on the same line which isn't intangible + ;; and move there. + (let ((after (and (< new (point-max)) + (get-char-property new 'intangible))) + (before (and (> new (point-min)) + (get-char-property (1- new) 'intangible))) + line-end) + (when (and before (eq before after)) + (setq line-end (save-excursion (end-of-line) (point))) + (goto-char (point-min)) + (let ((inhibit-point-motion-hooks nil)) + (goto-char new)) + (if (<= new line-end) + (setq new (point))))) ;; Remember where we moved to, go back home, ;; then do the motion over again ;; in just one step, with intangibility and point-motion hooks ;; enabled this time. - (setq new (point)) (goto-char opoint) (setq inhibit-point-motion-hooks nil) (goto-char new))) @@ -2556,10 +2571,7 @@ Setting this variable automatically makes it local to the current buffer." (let ((prefix (fill-context-prefix (save-excursion (backward-paragraph 1) (point)) - (save-excursion (forward-paragraph 1) (point)) - ;; Don't accept a non-whitespace fill prefix - ;; from the first line of a paragraph. - "^[ \t]*$"))) + (save-excursion (forward-paragraph 1) (point))))) (and prefix (not (equal prefix "")) (setq fill-prefix prefix)))) @@ -3400,9 +3412,18 @@ If this function moves point, it can alter the end of that completion.") (completion-list-mode) (make-local-variable 'completion-reference-buffer) (setq completion-reference-buffer mainbuf) -;;; The value 0 is right in most cases, but not for file name completion. -;;; so this has to be turned off. -;;; (setq completion-base-size 0) + (if (eq minibuffer-completion-table 'read-file-name-internal) + ;; For file name completion, + ;; use the number of chars before the start of the + ;; last file name component. + (setq completion-base-size + (save-excursion + (set-buffer mainbuf) + (goto-char (point-max)) + (skip-chars-backward (format "^%c" directory-sep-char)) + (- (point) (point-min)))) + ;; Otherwise, the whole input is the text being completed. + (setq completion-base-size 0)) (goto-char (point-min)) (if window-system (insert (substitute-command-keys -- 2.39.5