Commit 3137dda8 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(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.
parent 993e3059
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> 2007-09-16 Micha,Ak(Bl Cadilhac <michael@cadilhac.name>
* calendar/holidays.el (list-holidays): Remove the cyclic alias. * calendar/holidays.el (list-holidays): Remove the cyclic alias.
...@@ -203,6 +212,19 @@ ...@@ -203,6 +212,19 @@
2007-09-10 Stefan Monnier <monnier@iro.umontreal.ca> 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): * outline.el (outline-4, outline-5, outline-7):
Move font-lock-builtin-face down from 4 to 7 to better keep the 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. progression of color brightness, and to better match Org-mode's faces.
......
...@@ -457,7 +457,7 @@ than the value of `fill-column' and ARG is nil." ...@@ -457,7 +457,7 @@ than the value of `fill-column' and ARG is nil."
;; Mark the newline(s) `hard'. ;; Mark the newline(s) `hard'.
(if use-hard-newlines (if use-hard-newlines
(set-hard-newline-properties (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, ;; If the newline leaves the previous line blank,
;; and we have a left margin, delete that from the blank line. ;; and we have a left margin, delete that from the blank line.
(or flag (or flag
...@@ -1043,7 +1043,7 @@ display the result of expression evaluation." ...@@ -1043,7 +1043,7 @@ display the result of expression evaluation."
(if (boundp 'edebug-active) edebug-active))) (if (boundp 'edebug-active) edebug-active)))
(let ((char-string (let ((char-string
(if (or (if (boundp 'edebug-active) edebug-active) (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)))) (prin1-char value))))
(if char-string (if char-string
(format " (#o%o, #x%x, %s)" value value char-string) (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,7 +2815,7 @@ The argument is used for internal purposes; do not supply one."
(defcustom yank-excluded-properties (defcustom yank-excluded-properties
'(read-only invisible intangible field mouse-face help-echo local-map keymap '(read-only invisible intangible field mouse-face help-echo local-map keymap
yank-handler follow-link fontified) 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, The value should be a list of text properties to discard or t,
which means to discard all text properties." which means to discard all text properties."
:type '(choice (const :tag "All" t) (repeat symbol)) :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,7 +3623,7 @@ The beginning of a blank line does not count as the end of a line."
"Current goal column for vertical motion. "Current goal column for vertical motion.
It is the column where point was It is the column where point was
at the start of current run of vertical motion commands. 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 (defcustom line-move-ignore-invisible t
"*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines. "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
...@@ -3645,7 +3645,7 @@ Outline mode sets this." ...@@ -3645,7 +3645,7 @@ Outline mode sets this."
(vpos (nth 1 lh)) (vpos (nth 1 lh))
(ypos (nth 2 lh)) (ypos (nth 2 lh))
(rbot (nth 3 lh)) (rbot (nth 3 lh))
ppos py vs) py vs)
(when (or (null lh) (when (or (null lh)
(>= rbot (frame-char-height)) (>= rbot (frame-char-height))
(<= ypos (- (frame-char-height)))) (<= ypos (- (frame-char-height))))
...@@ -3722,11 +3722,11 @@ Outline mode sets this." ...@@ -3722,11 +3722,11 @@ Outline mode sets this."
;; Don't count beg of empty line as end of line ;; Don't count beg of empty line as end of line
;; unless we just did explicit end-of-line. ;; unless we just did explicit end-of-line.
(or (not (bolp)) (eq last-command 'move-end-of-line))) (or (not (bolp)) (eq last-command 'move-end-of-line)))
9999 most-positive-fixnum
(current-column)))) (current-column))))
(if (and (not (integerp selective-display)) (if (not (or (integerp selective-display)
(not line-move-ignore-invisible)) line-move-ignore-invisible))
;; Use just newline characters. ;; Use just newline characters.
;; Set ARG to 0 if we move as many lines as requested. ;; Set ARG to 0 if we move as many lines as requested.
(or (if (> arg 0) (or (if (> arg 0)
...@@ -3965,7 +3965,8 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." ...@@ -3965,7 +3965,8 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
(not (bobp)) (not (bobp))
(progn (progn
(while (and (not (bobp)) (invisible-p (1- (point)))) (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))) (backward-char 1)))
(point))))) (point)))))
(goto-char newpos) (goto-char newpos)
...@@ -3992,7 +3993,7 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." ...@@ -3992,7 +3993,7 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
(or arg (setq arg 1)) (or arg (setq arg 1))
(let ((orig (point)) (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). ;; Move by lines, if ARG is not 1 (the default).
(if (/= arg 1) (if (/= arg 1)
...@@ -4003,7 +4004,6 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." ...@@ -4003,7 +4004,6 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
(while (and (not (bobp)) (invisible-p (1- (point)))) (while (and (not (bobp)) (invisible-p (1- (point))))
(goto-char (previous-char-property-change (point))) (goto-char (previous-char-property-change (point)))
(skip-chars-backward "^\n")) (skip-chars-backward "^\n"))
(setq start (point))
;; Now find first visible char in the line ;; Now find first visible char in the line
(while (and (not (eobp)) (invisible-p (point))) (while (and (not (eobp)) (invisible-p (point)))
...@@ -4654,86 +4654,82 @@ it skips the contents of comments that end before point." ...@@ -4654,86 +4654,82 @@ it skips the contents of comments that end before point."
(skip-syntax-backward "/\\") (skip-syntax-backward "/\\")
(point)))))) (point))))))
(let* ((oldpos (point)) (let* ((oldpos (point))
blinkpos (message-log-max nil) ; Don't log messages about paren matching.
message-log-max ; Don't log messages about paren matching. (blinkpos
matching-paren (save-excursion
open-paren-line-string) (save-restriction
(save-excursion (if blink-matching-paren-distance
(save-restriction (narrow-to-region
(if blink-matching-paren-distance (max (minibuffer-prompt-end) ;(point-min) unless minibuf.
(narrow-to-region (max (minibuffer-prompt-end) (- (point) blink-matching-paren-distance))
(- (point) blink-matching-paren-distance)) oldpos))
oldpos)) (let ((parse-sexp-ignore-comments
(condition-case () (and parse-sexp-ignore-comments
(let ((parse-sexp-ignore-comments (not blink-matching-paren-dont-ignore-comments))))
(and parse-sexp-ignore-comments (condition-case ()
(not blink-matching-paren-dont-ignore-comments)))) (scan-sexps oldpos -1)
(setq blinkpos (scan-sexps oldpos -1))) (error nil))))))
(error nil))) (matching-paren
(and blinkpos (and blinkpos
;; Not syntax '$'. ;; Not syntax '$'.
(not (eq (syntax-class (syntax-after blinkpos)) 8)) (not (eq (syntax-class (syntax-after blinkpos)) 8))
(setq matching-paren (let ((syntax (syntax-after blinkpos)))
(let ((syntax (syntax-after blinkpos))) (and (consp syntax)
(and (consp syntax) (eq (syntax-class syntax) 4)
(eq (syntax-class syntax) 4) (cdr syntax))))))
(cdr syntax))))) (cond
(cond ((not (or (eq matching-paren (char-before oldpos))
((not (or (eq matching-paren (char-before oldpos)) ;; The cdr might hold a new paren-class info rather than
;; The cdr might hold a new paren-class info rather than ;; a matching-char info, in which case the two CDRs
;; a matching-char info, in which case the two CDRs ;; should match.
;; should match. (eq matching-paren (cdr (syntax-after (1- oldpos))))))
(eq matching-paren (cdr (syntax-after (1- oldpos)))))) (message "Mismatched parentheses"))
(message "Mismatched parentheses")) ((not blinkpos)
((not blinkpos) (if (not blink-matching-paren-distance)
(if (not blink-matching-paren-distance) (message "Unmatched parenthesis")))
(message "Unmatched parenthesis"))) ((pos-visible-in-window-p blinkpos)
((pos-visible-in-window-p blinkpos) ;; Matching open within window, temporarily move to blinkpos but only
;; Matching open within window, temporarily move to blinkpos but only ;; if `blink-matching-paren-on-screen' is non-nil.
;; if `blink-matching-paren-on-screen' is non-nil. (and blink-matching-paren-on-screen
(and blink-matching-paren-on-screen (not show-paren-mode)
(not show-paren-mode) (save-excursion
(save-excursion (goto-char blinkpos)
(goto-char blinkpos) (sit-for blink-matching-delay))))
(sit-for blink-matching-delay)))) (t
(t (save-excursion
(save-excursion (goto-char blinkpos)
(goto-char blinkpos) (let ((open-paren-line-string
(setq open-paren-line-string ;; Show what precedes the open in its line, if anything.
;; Show what precedes the open in its line, if anything. (cond
(if (save-excursion ((save-excursion (skip-chars-backward " \t") (not (bolp)))
(skip-chars-backward " \t") (buffer-substring (line-beginning-position)
(not (bolp))) (1+ blinkpos)))
(buffer-substring (line-beginning-position) ;; Show what follows the open in its line, if anything.
(1+ blinkpos)) ((save-excursion
;; Show what follows the open in its line, if anything. (forward-char 1)
(if (save-excursion (skip-chars-forward " \t")
(forward-char 1) (not (eolp)))
(skip-chars-forward " \t") (buffer-substring blinkpos
(not (eolp))) (line-end-position)))
(buffer-substring blinkpos ;; Otherwise show the previous nonblank line,
(line-end-position)) ;; if there is one.
;; Otherwise show the previous nonblank line, ((save-excursion (skip-chars-backward "\n \t") (not (bobp)))
;; if there is one. (concat
(if (save-excursion (buffer-substring (progn
(skip-chars-backward "\n \t") (skip-chars-backward "\n \t")
(not (bobp))) (line-beginning-position))
(concat (progn (end-of-line)
(buffer-substring (progn (skip-chars-backward " \t")
(skip-chars-backward "\n \t") (point)))
(line-beginning-position)) ;; Replace the newline and other whitespace with `...'.
(progn (end-of-line) "..."
(skip-chars-backward " \t") (buffer-substring blinkpos (1+ blinkpos))))
(point))) ;; There is nothing to show except the char itself.
;; Replace the newline and other whitespace with `...'. (t (buffer-substring blinkpos (1+ blinkpos))))))
"..." (message "Matches %s"
(buffer-substring blinkpos (1+ blinkpos))) (substring-no-properties open-paren-line-string)))))))))
;; There is nothing to show except the char itself.
(buffer-substring blinkpos (1+ blinkpos))))))) ;; Turned off because it makes dbx bomb out.
(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) (setq blink-paren-function 'blink-matching-open)
;; This executes C-g typed while Emacs is waiting for a command. ;; This executes C-g typed while Emacs is waiting for a command.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment