changeset 18034:0d96c759902b

(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.
author Richard M. Stallman <rms@gnu.org>
date Fri, 30 May 1997 00:58:54 +0000
parents bccd356a3b7c
children edf54f605b36
files lisp/simple.el
diffstat 1 files changed, 29 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Fri May 30 00:39:40 1997 +0000
+++ b/lisp/simple.el	Fri May 30 00:58:54 1997 +0000
@@ -1943,11 +1943,26 @@
 	      (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 @@
 	  (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 @@
       (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