aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-09-16 22:11:33 +0000
committerStefan Monnier2007-09-16 22:11:33 +0000
commit3137dda821abbd5652d3cb9bd116e3ea5f61f2fd (patch)
tree9e3eec9c6e2e7432e33e242d6134642fd65763ae
parent993e30596b0d935f33588f868dc0e19eda5820aa (diff)
downloademacs-3137dda821abbd5652d3cb9bd116e3ea5f61f2fd.tar.gz
emacs-3137dda821abbd5652d3cb9bd116e3ea5f61f2fd.zip
(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.
-rw-r--r--lisp/ChangeLog22
-rw-r--r--lisp/simple.el178
2 files changed, 109 insertions, 91 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7f6418a75e5..ccebe09c4d1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12007-09-16 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * simple.el (newline): Simplify use of prefix-numeric-value.
4 (line-move-partial): Remove unused var `ppos'.
5 (line-move-1): Replace 9999 with most-positive-fixnum.
6 (move-end-of-line): Use more efficient single-property search.
7 (move-beginning-of-line): Remove unused var `start'.
8 (blink-matching-open): Restructure in a more functional style.
9
12007-09-16 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> 102007-09-16 Micha,Ak(Bl Cadilhac <michael@cadilhac.name>
2 11
3 * calendar/holidays.el (list-holidays): Remove the cyclic alias. 12 * calendar/holidays.el (list-holidays): Remove the cyclic alias.
@@ -203,6 +212,19 @@
203 212
2042007-09-10 Stefan Monnier <monnier@iro.umontreal.ca> 2132007-09-10 Stefan Monnier <monnier@iro.umontreal.ca>
205 214
215 * progmodes/python.el: Merge changes from Dave Love's v2007-Sep-10.
216 (python-font-lock-keywords): Update to the 2.5 version of the language.
217 (python-quote-syntax): Let-bind font-lock-syntactic-keywords to nil.
218 (python-backspace): Only behave funny in code.
219 (python-compilation-regexp-alist): Add PDB stack trace regexp.
220 (inferior-python-mode): Add PDB prompt regexp.
221 (python-fill-paragraph): Refine the fenced-string regexp.
222 (python-find-imports): Handle imports spanning several lines.
223 (python-mode): Add `class' to hideshow support.
224
2252007-09-10 Dave Love <fx@gnu.org>
226
227
206 * outline.el (outline-4, outline-5, outline-7): 228 * outline.el (outline-4, outline-5, outline-7):
207 Move font-lock-builtin-face down from 4 to 7 to better keep the 229 Move font-lock-builtin-face down from 4 to 7 to better keep the
208 progression of color brightness, and to better match Org-mode's faces. 230 progression of color brightness, and to better match Org-mode's faces.
diff --git a/lisp/simple.el b/lisp/simple.el
index 02193af41d4..2a98ca19ecc 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -457,7 +457,7 @@ than the value of `fill-column' and ARG is nil."
457 ;; Mark the newline(s) `hard'. 457 ;; Mark the newline(s) `hard'.
458 (if use-hard-newlines 458 (if use-hard-newlines
459 (set-hard-newline-properties 459 (set-hard-newline-properties
460 (- (point) (if arg (prefix-numeric-value arg) 1)) (point))) 460 (- (point) (prefix-numeric-value arg)) (point)))
461 ;; If the newline leaves the previous line blank, 461 ;; If the newline leaves the previous line blank,
462 ;; and we have a left margin, delete that from the blank line. 462 ;; and we have a left margin, delete that from the blank line.
463 (or flag 463 (or flag
@@ -1043,7 +1043,7 @@ display the result of expression evaluation."
1043 (if (boundp 'edebug-active) edebug-active))) 1043 (if (boundp 'edebug-active) edebug-active)))
1044 (let ((char-string 1044 (let ((char-string
1045 (if (or (if (boundp 'edebug-active) edebug-active) 1045 (if (or (if (boundp 'edebug-active) edebug-active)
1046 (memq this-command '(eval-last-sexp eval-print-last-sexp))) 1046 (memq this-command '(eval-last-sexp eval-print-last-sexp)))
1047 (prin1-char value)))) 1047 (prin1-char value))))
1048 (if char-string 1048 (if char-string
1049 (format " (#o%o, #x%x, %s)" value value char-string) 1049 (format " (#o%o, #x%x, %s)" value value char-string)
@@ -2815,7 +2815,7 @@ The argument is used for internal purposes; do not supply one."
2815(defcustom yank-excluded-properties 2815(defcustom yank-excluded-properties
2816 '(read-only invisible intangible field mouse-face help-echo local-map keymap 2816 '(read-only invisible intangible field mouse-face help-echo local-map keymap
2817 yank-handler follow-link fontified) 2817 yank-handler follow-link fontified)
2818 "*Text properties to discard when yanking. 2818 "Text properties to discard when yanking.
2819The value should be a list of text properties to discard or t, 2819The value should be a list of text properties to discard or t,
2820which means to discard all text properties." 2820which means to discard all text properties."
2821 :type '(choice (const :tag "All" t) (repeat symbol)) 2821 :type '(choice (const :tag "All" t) (repeat symbol))
@@ -3623,7 +3623,7 @@ The beginning of a blank line does not count as the end of a line."
3623 "Current goal column for vertical motion. 3623 "Current goal column for vertical motion.
3624It is the column where point was 3624It is the column where point was
3625at the start of current run of vertical motion commands. 3625at the start of current run of vertical motion commands.
3626When the `track-eol' feature is doing its job, the value is 9999.") 3626When the `track-eol' feature is doing its job, the value is `most-positive-fixnum'.")
3627 3627
3628(defcustom line-move-ignore-invisible t 3628(defcustom line-move-ignore-invisible t
3629 "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines. 3629 "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
@@ -3645,7 +3645,7 @@ Outline mode sets this."
3645 (vpos (nth 1 lh)) 3645 (vpos (nth 1 lh))
3646 (ypos (nth 2 lh)) 3646 (ypos (nth 2 lh))
3647 (rbot (nth 3 lh)) 3647 (rbot (nth 3 lh))
3648 ppos py vs) 3648 py vs)
3649 (when (or (null lh) 3649 (when (or (null lh)
3650 (>= rbot (frame-char-height)) 3650 (>= rbot (frame-char-height))
3651 (<= ypos (- (frame-char-height)))) 3651 (<= ypos (- (frame-char-height))))
@@ -3722,11 +3722,11 @@ Outline mode sets this."
3722 ;; Don't count beg of empty line as end of line 3722 ;; Don't count beg of empty line as end of line
3723 ;; unless we just did explicit end-of-line. 3723 ;; unless we just did explicit end-of-line.
3724 (or (not (bolp)) (eq last-command 'move-end-of-line))) 3724 (or (not (bolp)) (eq last-command 'move-end-of-line)))
3725 9999 3725 most-positive-fixnum
3726 (current-column)))) 3726 (current-column))))
3727 3727
3728 (if (and (not (integerp selective-display)) 3728 (if (not (or (integerp selective-display)
3729 (not line-move-ignore-invisible)) 3729 line-move-ignore-invisible))
3730 ;; Use just newline characters. 3730 ;; Use just newline characters.
3731 ;; Set ARG to 0 if we move as many lines as requested. 3731 ;; Set ARG to 0 if we move as many lines as requested.
3732 (or (if (> arg 0) 3732 (or (if (> arg 0)
@@ -3965,7 +3965,8 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
3965 (not (bobp)) 3965 (not (bobp))
3966 (progn 3966 (progn
3967 (while (and (not (bobp)) (invisible-p (1- (point)))) 3967 (while (and (not (bobp)) (invisible-p (1- (point))))
3968 (goto-char (previous-char-property-change (point)))) 3968 (goto-char (previous-single-char-property-change
3969 (point) 'invisible)))
3969 (backward-char 1))) 3970 (backward-char 1)))
3970 (point))))) 3971 (point)))))
3971 (goto-char newpos) 3972 (goto-char newpos)
@@ -3992,7 +3993,7 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
3992 (or arg (setq arg 1)) 3993 (or arg (setq arg 1))
3993 3994
3994 (let ((orig (point)) 3995 (let ((orig (point))
3995 start first-vis first-vis-field-value) 3996 first-vis first-vis-field-value)
3996 3997
3997 ;; Move by lines, if ARG is not 1 (the default). 3998 ;; Move by lines, if ARG is not 1 (the default).
3998 (if (/= arg 1) 3999 (if (/= arg 1)
@@ -4003,7 +4004,6 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
4003 (while (and (not (bobp)) (invisible-p (1- (point)))) 4004 (while (and (not (bobp)) (invisible-p (1- (point))))
4004 (goto-char (previous-char-property-change (point))) 4005 (goto-char (previous-char-property-change (point)))
4005 (skip-chars-backward "^\n")) 4006 (skip-chars-backward "^\n"))
4006 (setq start (point))
4007 4007
4008 ;; Now find first visible char in the line 4008 ;; Now find first visible char in the line
4009 (while (and (not (eobp)) (invisible-p (point))) 4009 (while (and (not (eobp)) (invisible-p (point)))
@@ -4654,86 +4654,82 @@ it skips the contents of comments that end before point."
4654 (skip-syntax-backward "/\\") 4654 (skip-syntax-backward "/\\")
4655 (point)))))) 4655 (point))))))
4656 (let* ((oldpos (point)) 4656 (let* ((oldpos (point))
4657 blinkpos 4657 (message-log-max nil) ; Don't log messages about paren matching.
4658 message-log-max ; Don't log messages about paren matching. 4658 (blinkpos
4659 matching-paren 4659 (save-excursion
4660 open-paren-line-string) 4660 (save-restriction
4661 (save-excursion 4661 (if blink-matching-paren-distance
4662 (save-restriction 4662 (narrow-to-region
4663 (if blink-matching-paren-distance 4663 (max (minibuffer-prompt-end) ;(point-min) unless minibuf.
4664 (narrow-to-region (max (minibuffer-prompt-end) 4664 (- (point) blink-matching-paren-distance))
4665 (- (point) blink-matching-paren-distance)) 4665 oldpos))
4666 oldpos)) 4666 (let ((parse-sexp-ignore-comments
4667 (condition-case () 4667 (and parse-sexp-ignore-comments
4668 (let ((parse-sexp-ignore-comments 4668 (not blink-matching-paren-dont-ignore-comments))))
4669 (and parse-sexp-ignore-comments 4669 (condition-case ()
4670 (not blink-matching-paren-dont-ignore-comments)))) 4670 (scan-sexps oldpos -1)
4671 (setq blinkpos (scan-sexps oldpos -1))) 4671 (error nil))))))
4672 (error nil))) 4672 (matching-paren
4673 (and blinkpos 4673 (and blinkpos
4674 ;; Not syntax '$'. 4674 ;; Not syntax '$'.
4675 (not (eq (syntax-class (syntax-after blinkpos)) 8)) 4675 (not (eq (syntax-class (syntax-after blinkpos)) 8))
4676 (setq matching-paren 4676 (let ((syntax (syntax-after blinkpos)))
4677 (let ((syntax (syntax-after blinkpos))) 4677 (and (consp syntax)
4678 (and (consp syntax) 4678 (eq (syntax-class syntax) 4)
4679 (eq (syntax-class syntax) 4) 4679 (cdr syntax))))))
4680 (cdr syntax))))) 4680 (cond
4681 (cond 4681 ((not (or (eq matching-paren (char-before oldpos))
4682 ((not (or (eq matching-paren (char-before oldpos)) 4682 ;; The cdr might hold a new paren-class info rather than
4683 ;; The cdr might hold a new paren-class info rather than 4683 ;; a matching-char info, in which case the two CDRs
4684 ;; a matching-char info, in which case the two CDRs 4684 ;; should match.
4685 ;; should match. 4685 (eq matching-paren (cdr (syntax-after (1- oldpos))))))
4686 (eq matching-paren (cdr (syntax-after (1- oldpos)))))) 4686 (message "Mismatched parentheses"))
4687 (message "Mismatched parentheses")) 4687 ((not blinkpos)
4688 ((not blinkpos) 4688 (if (not blink-matching-paren-distance)
4689 (if (not blink-matching-paren-distance) 4689 (message "Unmatched parenthesis")))
4690 (message "Unmatched parenthesis"))) 4690 ((pos-visible-in-window-p blinkpos)
4691 ((pos-visible-in-window-p blinkpos) 4691 ;; Matching open within window, temporarily move to blinkpos but only
4692 ;; Matching open within window, temporarily move to blinkpos but only 4692 ;; if `blink-matching-paren-on-screen' is non-nil.
4693 ;; if `blink-matching-paren-on-screen' is non-nil. 4693 (and blink-matching-paren-on-screen
4694 (and blink-matching-paren-on-screen 4694 (not show-paren-mode)
4695 (not show-paren-mode) 4695 (save-excursion
4696 (save-excursion 4696 (goto-char blinkpos)
4697 (goto-char blinkpos) 4697 (sit-for blink-matching-delay))))
4698 (sit-for blink-matching-delay)))) 4698 (t
4699 (t 4699 (save-excursion
4700 (save-excursion 4700 (goto-char blinkpos)
4701 (goto-char blinkpos) 4701 (let ((open-paren-line-string
4702 (setq open-paren-line-string 4702 ;; Show what precedes the open in its line, if anything.
4703 ;; Show what precedes the open in its line, if anything. 4703 (cond
4704 (if (save-excursion 4704 ((save-excursion (skip-chars-backward " \t") (not (bolp)))
4705 (skip-chars-backward " \t") 4705 (buffer-substring (line-beginning-position)
4706 (not (bolp))) 4706 (1+ blinkpos)))
4707 (buffer-substring (line-beginning-position) 4707 ;; Show what follows the open in its line, if anything.
4708 (1+ blinkpos)) 4708 ((save-excursion
4709 ;; Show what follows the open in its line, if anything. 4709 (forward-char 1)
4710 (if (save-excursion 4710 (skip-chars-forward " \t")
4711 (forward-char 1) 4711 (not (eolp)))
4712 (skip-chars-forward " \t") 4712 (buffer-substring blinkpos
4713 (not (eolp))) 4713 (line-end-position)))
4714 (buffer-substring blinkpos 4714 ;; Otherwise show the previous nonblank line,
4715 (line-end-position)) 4715 ;; if there is one.
4716 ;; Otherwise show the previous nonblank line, 4716 ((save-excursion (skip-chars-backward "\n \t") (not (bobp)))
4717 ;; if there is one. 4717 (concat
4718 (if (save-excursion 4718 (buffer-substring (progn
4719 (skip-chars-backward "\n \t") 4719 (skip-chars-backward "\n \t")
4720 (not (bobp))) 4720 (line-beginning-position))
4721 (concat 4721 (progn (end-of-line)
4722 (buffer-substring (progn 4722 (skip-chars-backward " \t")
4723 (skip-chars-backward "\n \t") 4723 (point)))
4724 (line-beginning-position)) 4724 ;; Replace the newline and other whitespace with `...'.
4725 (progn (end-of-line) 4725 "..."
4726 (skip-chars-backward " \t") 4726 (buffer-substring blinkpos (1+ blinkpos))))
4727 (point))) 4727 ;; There is nothing to show except the char itself.
4728 ;; Replace the newline and other whitespace with `...'. 4728 (t (buffer-substring blinkpos (1+ blinkpos))))))
4729 "..." 4729 (message "Matches %s"
4730 (buffer-substring blinkpos (1+ blinkpos))) 4730 (substring-no-properties open-paren-line-string)))))))))
4731 ;; There is nothing to show except the char itself. 4731
4732 (buffer-substring blinkpos (1+ blinkpos))))))) 4732;; Turned off because it makes dbx bomb out.
4733 (message "Matches %s"
4734 (substring-no-properties open-paren-line-string))))))))
4735
4736;Turned off because it makes dbx bomb out.
4737(setq blink-paren-function 'blink-matching-open) 4733(setq blink-paren-function 'blink-matching-open)
4738 4734
4739;; This executes C-g typed while Emacs is waiting for a command. 4735;; This executes C-g typed while Emacs is waiting for a command.