]> code.delx.au - gnu-emacs/blobdiff - lisp/simple.el
entered into RCS
[gnu-emacs] / lisp / simple.el
index 2da71888eda29a12dacd6f795cf3a67889745c1b..982bd78047d8ff08e2be4db7c20bfaee840bc0f2 100644 (file)
@@ -56,6 +56,7 @@ You may also type up to 3 octal digits, to insert a character with that code"
 
 (defun delete-indentation (&optional arg)
   "Join this line to previous and fix up whitespace at join.
+If there is a fill prefix, delete it from the beginning of this line.
 With argument, join this line to following line."
   (interactive "*P")
   (beginning-of-line)
@@ -63,6 +64,13 @@ With argument, join this line to following line."
   (if (eq (preceding-char) ?\n)
       (progn
        (delete-region (point) (1- (point)))
+       ;; If the second line started with the fill prefix,
+       ;; delete the prefix.
+       (if (and fill-prefix
+                (string= fill-prefix
+                         (buffer-substring (point)
+                                           (+ (point) (length fill-prefix)))))
+           (delete-region (point) (+ (point) (length fill-prefix))))
        (fixup-whitespace))))
 
 (defun fixup-whitespace ()
@@ -334,7 +342,7 @@ Other major modes are defined by comparison with this one."
 ;; for the sake of completion of names like eval-region, eval-current-buffer.
 (defun eval-expression (expression)
   "Evaluate EXPRESSION and print value in minibuffer.
-Value is also consed on to front of variable  values  's value."
+Value is also consed on to front of the variable `values'."
   (interactive "xEval: ")
   (setq values (cons (eval expression) values))
   (prin1 (car values) t))
@@ -384,52 +392,35 @@ to get different commands to edit and resubmit."
 (setq minibuffer-history-variable 'minibuffer-history)
 (setq minibuffer-history-position nil)
 
-(define-key minibuffer-local-map "\en" 'next-history-element)
-(define-key minibuffer-local-ns-map "\en" 'next-history-element)
-(define-key minibuffer-local-ns-map "\en" 'next-history-element)
-(define-key minibuffer-local-completion-map "\en" 'next-history-element)
-(define-key minibuffer-local-completion-map "\en" 'next-history-element)
-(define-key minibuffer-local-must-match-map "\en" 'next-history-element)
-
-(define-key minibuffer-local-map "\ep" 'previous-history-element)
-(define-key minibuffer-local-ns-map "\ep" 'previous-history-element)
-(define-key minibuffer-local-ns-map "\ep" 'previous-history-element)
-(define-key minibuffer-local-completion-map "\ep" 'previous-history-element)
-(define-key minibuffer-local-completion-map "\ep" 'previous-history-element)
-(define-key minibuffer-local-must-match-map "\ep" 'previous-history-element)
-
-(define-key minibuffer-local-map "\er" 'previous-matching-history-element)
-(define-key minibuffer-local-ns-map "\er" 'previous-matching-history-element)
-(define-key minibuffer-local-ns-map "\er" 'previous-matching-history-element)
-(define-key minibuffer-local-completion-map "\er"
-  'previous-matching-history-element)
-(define-key minibuffer-local-completion-map "\er"
-  'previous-matching-history-element)
-(define-key minibuffer-local-must-match-map "\er"
-  'previous-matching-history-element)
-
-(define-key minibuffer-local-map "\es" 'next-matching-history-element)
-(define-key minibuffer-local-ns-map "\es" 'next-matching-history-element)
-(define-key minibuffer-local-ns-map "\es" 'next-matching-history-element)
-(define-key minibuffer-local-completion-map "\es"
-  'next-matching-history-element)
-(define-key minibuffer-local-completion-map "\es"
-  'next-matching-history-element)
-(define-key minibuffer-local-must-match-map "\es"
-  'next-matching-history-element)
+(mapcar
+ (function (lambda (key-and-command)
+            (mapcar
+             (function (lambda (keymap)
+                         (define-key (symbol-value keymap)
+                           (car key-and-command)
+                           (cdr key-and-command))))
+             '(minibuffer-local-map
+               minibuffer-local-ns-map
+               minibuffer-local-completion-map
+               minibuffer-local-must-match-map))))
+ '(("\en" . next-history-element) ([next] . next-history-element)
+   ("\ep" . previous-history-element) ([prior] . previous-history-element)
+   ("\er" . previous-matching-history-element)
+   ("\es" . next-matching-history-element)))
 
 (put 'previous-matching-history-element 'enable-recursive-minibuffers t)
 (defun previous-matching-history-element (regexp n)
   (interactive "sPrevious element matching (regexp): \np")
   (let ((history (symbol-value minibuffer-history-variable))
+       prevpos
        (pos minibuffer-history-position))
     (while (/= n 0)
       (setq prevpos pos)
       (setq pos (min (max 1 (+ pos (if (< n 0) -1 1))) (length history)))
       (if (= pos prevpos)
          (error (if (= pos 1)
-                    "No following item in minibuffer history"
-                  "No preceding item in minibuffer history")))
+                    "No later matching history item"
+                  "No earlier matching history item")))
       (if (string-match regexp
                        (if minibuffer-history-sexp-flag
                            (prin1-to-string (nth (1- pos) history))
@@ -455,8 +446,8 @@ to get different commands to edit and resubmit."
                   (length (symbol-value minibuffer-history-variable)))))
     (if (= minibuffer-history-position narg)
        (error (if (= minibuffer-history-position 1)
-                  "No following item in minibuffer history"
-                "No preceding item in minibuffer history"))
+                  "End of history; no next item"
+                "Beginning of history; no preceding item"))
       (erase-buffer)
       (setq minibuffer-history-position narg)
       (let ((elt (nth (1- minibuffer-history-position)
@@ -863,10 +854,6 @@ yanking point; just return the Nth kill forward."
   (let ((interprogram-paste (and (= n 0)
                                 interprogram-paste-function
                                 (funcall interprogram-paste-function))))
-;;; RMS: Turn off the interprogram paste feature 
-;;; because currently it is wedged: it is always
-;;; giving a null string.
-    (setq interprogram-paste nil)
     (if interprogram-paste
        (progn
          ;; Disable the interprogram cut function when we add the new