changeset 84609:653c328271e7

(newline): Simplify use of prefix-numeric-value. (line-move-partial): Remove unused var `ppos'. (line-move-1): Replace 9999 with most-positive-fixnum. (move-end-of-line): Use more efficient single-property search. (move-beginning-of-line): Remove unused var `start'. (blink-matching-open): Restructure in a more functional style.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 16 Sep 2007 22:11:33 +0000
parents 2768a568e11e
children b52ff2b36d6d
files lisp/ChangeLog lisp/simple.el
diffstat 2 files changed, 109 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Sep 16 21:42:40 2007 +0000
+++ b/lisp/ChangeLog	Sun Sep 16 22:11:33 2007 +0000
@@ -1,3 +1,12 @@
+2007-09-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* simple.el (newline): Simplify use of prefix-numeric-value.
+	(line-move-partial): Remove unused var `ppos'.
+	(line-move-1): Replace 9999 with most-positive-fixnum.
+	(move-end-of-line): Use more efficient single-property search.
+	(move-beginning-of-line): Remove unused var `start'.
+	(blink-matching-open): Restructure in a more functional style.
+
 2007-09-16  Micha,Ak(Bl Cadilhac  <michael@cadilhac.name>
 
 	* calendar/holidays.el (list-holidays): Remove the cyclic alias.
@@ -203,6 +212,19 @@
 
 2007-09-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* progmodes/python.el: Merge changes from Dave Love's v2007-Sep-10.
+	(python-font-lock-keywords): Update to the 2.5 version of the language.
+	(python-quote-syntax): Let-bind font-lock-syntactic-keywords to nil.
+	(python-backspace): Only behave funny in code.
+	(python-compilation-regexp-alist): Add PDB stack trace regexp.
+	(inferior-python-mode): Add PDB prompt regexp.
+	(python-fill-paragraph): Refine the fenced-string regexp.
+	(python-find-imports): Handle imports spanning several lines.
+	(python-mode): Add `class' to hideshow support.
+
+2007-09-10  Dave Love  <fx@gnu.org>
+
+
 	* outline.el (outline-4, outline-5, outline-7):
 	Move font-lock-builtin-face down from 4 to 7 to better keep the
 	progression of color brightness, and to better match Org-mode's faces.
--- a/lisp/simple.el	Sun Sep 16 21:42:40 2007 +0000
+++ b/lisp/simple.el	Sun Sep 16 22:11:33 2007 +0000
@@ -457,7 +457,7 @@
     ;; Mark the newline(s) `hard'.
     (if use-hard-newlines
 	(set-hard-newline-properties
-	 (- (point) (if arg (prefix-numeric-value arg) 1)) (point)))
+	 (- (point) (prefix-numeric-value arg)) (point)))
     ;; If the newline leaves the previous line blank,
     ;; and we have a left margin, delete that from the blank line.
     (or flag
@@ -1043,7 +1043,7 @@
                (if (boundp 'edebug-active) edebug-active)))
       (let ((char-string
              (if (or (if (boundp 'edebug-active) edebug-active)
-                     (memq this-command '(eval-last-sexp eval-print-last-sexp)))
+		     (memq this-command '(eval-last-sexp eval-print-last-sexp)))
                  (prin1-char value))))
         (if char-string
             (format " (#o%o, #x%x, %s)" value value char-string)
@@ -2815,7 +2815,7 @@
 (defcustom yank-excluded-properties
   '(read-only invisible intangible field mouse-face help-echo local-map keymap
     yank-handler follow-link fontified)
-  "*Text properties to discard when yanking.
+  "Text properties to discard when yanking.
 The value should be a list of text properties to discard or t,
 which means to discard all text properties."
   :type '(choice (const :tag "All" t) (repeat symbol))
@@ -3623,7 +3623,7 @@
   "Current goal column for vertical motion.
 It is the column where point was
 at the start of current run of vertical motion commands.
-When the `track-eol' feature is doing its job, the value is 9999.")
+When the `track-eol' feature is doing its job, the value is `most-positive-fixnum'.")
 
 (defcustom line-move-ignore-invisible t
   "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
@@ -3645,7 +3645,7 @@
 	   (vpos (nth 1 lh))
 	   (ypos (nth 2 lh))
 	   (rbot (nth 3 lh))
-	   ppos py vs)
+	   py vs)
       (when (or (null lh)
 		(>= rbot (frame-char-height))
 		(<= ypos (- (frame-char-height))))
@@ -3722,11 +3722,11 @@
 			     ;; Don't count beg of empty line as end of line
 			     ;; unless we just did explicit end-of-line.
 			     (or (not (bolp)) (eq last-command 'move-end-of-line)))
-			9999
+			most-positive-fixnum
 		      (current-column))))
 
-	  (if (and (not (integerp selective-display))
-		   (not line-move-ignore-invisible))
+	  (if (not (or (integerp selective-display)
+                       line-move-ignore-invisible))
 	      ;; Use just newline characters.
 	      ;; Set ARG to 0 if we move as many lines as requested.
 	      (or (if (> arg 0)
@@ -3965,7 +3965,8 @@
 		      (not (bobp))
 		      (progn
 			(while (and (not (bobp)) (invisible-p (1- (point))))
-			  (goto-char (previous-char-property-change (point))))
+			  (goto-char (previous-single-char-property-change
+                                      (point) 'invisible)))
 			(backward-char 1)))
 		 (point)))))
 	(goto-char newpos)
@@ -3992,7 +3993,7 @@
   (or arg (setq arg 1))
 
   (let ((orig (point))
-	start first-vis first-vis-field-value)
+	first-vis first-vis-field-value)
 
     ;; Move by lines, if ARG is not 1 (the default).
     (if (/= arg 1)
@@ -4003,7 +4004,6 @@
     (while (and (not (bobp)) (invisible-p (1- (point))))
       (goto-char (previous-char-property-change (point)))
       (skip-chars-backward "^\n"))
-    (setq start (point))
 
     ;; Now find first visible char in the line
     (while (and (not (eobp)) (invisible-p (point)))
@@ -4654,86 +4654,82 @@
 				 (skip-syntax-backward "/\\")
 				 (point))))))
     (let* ((oldpos (point))
-	   blinkpos
-	   message-log-max  ; Don't log messages about paren matching.
-	   matching-paren
-	   open-paren-line-string)
-      (save-excursion
-	(save-restriction
-	  (if blink-matching-paren-distance
-	      (narrow-to-region (max (minibuffer-prompt-end)
-				     (- (point) blink-matching-paren-distance))
-				oldpos))
-	  (condition-case ()
-	      (let ((parse-sexp-ignore-comments
-		     (and parse-sexp-ignore-comments
-			  (not blink-matching-paren-dont-ignore-comments))))
-		(setq blinkpos (scan-sexps oldpos -1)))
-	    (error nil)))
-	(and blinkpos
-	     ;; Not syntax '$'.
-	     (not (eq (syntax-class (syntax-after blinkpos)) 8))
-	     (setq matching-paren
-		   (let ((syntax (syntax-after blinkpos)))
-		     (and (consp syntax)
-			  (eq (syntax-class syntax) 4)
-			  (cdr syntax)))))
-	(cond
-	 ((not (or (eq matching-paren (char-before oldpos))
-                   ;; The cdr might hold a new paren-class info rather than
-                   ;; a matching-char info, in which case the two CDRs
-                   ;; should match.
-                   (eq matching-paren (cdr (syntax-after (1- oldpos))))))
-	  (message "Mismatched parentheses"))
-	 ((not blinkpos)
-	  (if (not blink-matching-paren-distance)
-	      (message "Unmatched parenthesis")))
-	 ((pos-visible-in-window-p blinkpos)
-	  ;; Matching open within window, temporarily move to blinkpos but only
-	  ;; if `blink-matching-paren-on-screen' is non-nil.
-	  (and blink-matching-paren-on-screen
-	       (not show-paren-mode)
-	       (save-excursion
-		 (goto-char blinkpos)
-		 (sit-for blink-matching-delay))))
-	 (t
-	  (save-excursion
-	    (goto-char blinkpos)
-	    (setq open-paren-line-string
-		  ;; Show what precedes the open in its line, if anything.
-		  (if (save-excursion
-			(skip-chars-backward " \t")
-			(not (bolp)))
-		      (buffer-substring (line-beginning-position)
-					(1+ blinkpos))
-		    ;; Show what follows the open in its line, if anything.
-		    (if (save-excursion
-			  (forward-char 1)
-			  (skip-chars-forward " \t")
-			  (not (eolp)))
-			(buffer-substring blinkpos
-					  (line-end-position))
-		      ;; Otherwise show the previous nonblank line,
-		      ;; if there is one.
-		      (if (save-excursion
-			    (skip-chars-backward "\n \t")
-			    (not (bobp)))
-			  (concat
-			   (buffer-substring (progn
-					       (skip-chars-backward "\n \t")
-					       (line-beginning-position))
-					     (progn (end-of-line)
-						    (skip-chars-backward " \t")
-						    (point)))
-			   ;; Replace the newline and other whitespace with `...'.
-			   "..."
-			   (buffer-substring blinkpos (1+ blinkpos)))
-			;; There is nothing to show except the char itself.
-			(buffer-substring blinkpos (1+ blinkpos)))))))
-	  (message "Matches %s"
-		   (substring-no-properties open-paren-line-string))))))))
-
-;Turned off because it makes dbx bomb out.
+	   (message-log-max nil)  ; Don't log messages about paren matching.
+	   (blinkpos
+            (save-excursion
+              (save-restriction
+                (if blink-matching-paren-distance
+                    (narrow-to-region
+                     (max (minibuffer-prompt-end) ;(point-min) unless minibuf.
+                          (- (point) blink-matching-paren-distance))
+                     oldpos))
+                (let ((parse-sexp-ignore-comments
+                       (and parse-sexp-ignore-comments
+                            (not blink-matching-paren-dont-ignore-comments))))
+                  (condition-case ()
+                      (scan-sexps oldpos -1)
+                    (error nil))))))
+	   (matching-paren
+            (and blinkpos
+                 ;; Not syntax '$'.
+                 (not (eq (syntax-class (syntax-after blinkpos)) 8))
+                 (let ((syntax (syntax-after blinkpos)))
+                   (and (consp syntax)
+                        (eq (syntax-class syntax) 4)
+                        (cdr syntax))))))
+      (cond
+       ((not (or (eq matching-paren (char-before oldpos))
+                 ;; The cdr might hold a new paren-class info rather than
+                 ;; a matching-char info, in which case the two CDRs
+                 ;; should match.
+                 (eq matching-paren (cdr (syntax-after (1- oldpos))))))
+        (message "Mismatched parentheses"))
+       ((not blinkpos)
+        (if (not blink-matching-paren-distance)
+            (message "Unmatched parenthesis")))
+       ((pos-visible-in-window-p blinkpos)
+        ;; Matching open within window, temporarily move to blinkpos but only
+        ;; if `blink-matching-paren-on-screen' is non-nil.
+        (and blink-matching-paren-on-screen
+             (not show-paren-mode)
+             (save-excursion
+               (goto-char blinkpos)
+               (sit-for blink-matching-delay))))
+       (t
+        (save-excursion
+          (goto-char blinkpos)
+          (let ((open-paren-line-string
+                 ;; Show what precedes the open in its line, if anything.
+                 (cond
+                  ((save-excursion (skip-chars-backward " \t") (not (bolp)))
+                   (buffer-substring (line-beginning-position)
+                                     (1+ blinkpos)))
+                  ;; Show what follows the open in its line, if anything.
+                  ((save-excursion
+                     (forward-char 1)
+                     (skip-chars-forward " \t")
+                     (not (eolp)))
+                   (buffer-substring blinkpos
+                                     (line-end-position)))
+                  ;; Otherwise show the previous nonblank line,
+                  ;; if there is one.
+                  ((save-excursion (skip-chars-backward "\n \t") (not (bobp)))
+                   (concat
+                    (buffer-substring (progn
+                                        (skip-chars-backward "\n \t")
+                                        (line-beginning-position))
+                                      (progn (end-of-line)
+                                             (skip-chars-backward " \t")
+                                             (point)))
+                    ;; Replace the newline and other whitespace with `...'.
+                    "..."
+                    (buffer-substring blinkpos (1+ blinkpos))))
+                  ;; There is nothing to show except the char itself.
+                  (t (buffer-substring blinkpos (1+ blinkpos))))))
+            (message "Matches %s"
+                     (substring-no-properties open-paren-line-string)))))))))
+
+;; Turned off because it makes dbx bomb out.
 (setq blink-paren-function 'blink-matching-open)
 
 ;; This executes C-g typed while Emacs is waiting for a command.