Now on revision 113728. ------------------------------------------------------------ revno: 113728 committer: Xue Fuqiao branch nick: trunk timestamp: Wed 2013-08-07 10:25:52 +0800 message: doc/misc/cl.texi: Add indexes. * doc/misc/cl.texi (Argument Lists): (For Clauses): Add indexes. diff: === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2013-08-06 06:53:09 +0000 +++ doc/lispref/display.texi 2013-08-07 02:25:52 +0000 @@ -1243,6 +1243,7 @@ @node Overlays @section Overlays @cindex overlays +@c FIXME: mention intervals in this section? You can use @dfn{overlays} to alter the appearance of a buffer's text on the screen, for the sake of presentation features. An overlay is an === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2013-08-05 13:28:29 +0000 +++ doc/misc/ChangeLog 2013-08-07 02:25:52 +0000 @@ -1,3 +1,8 @@ +2013-08-07 Xue Fuqiao + + * cl.texi (Argument Lists): + (For Clauses): Add indexes. + 2013-08-05 Xue Fuqiao * cl.texi (Blocks and Exits): Add an index. === modified file 'doc/misc/cl.texi' --- doc/misc/cl.texi 2013-08-05 13:28:29 +0000 +++ doc/misc/cl.texi 2013-08-07 02:25:52 +0000 @@ -461,6 +461,7 @@ @var{body})) @end example +@cindex destructuring, in argument list Argument lists support @dfn{destructuring}. In Common Lisp, destructuring is only allowed with @code{defmacro}; this package allows it with @code{cl-defun} and other argument lists as well. @@ -2140,6 +2141,7 @@ based on the value of @code{x} left over from the previous time through the loop. +@cindex destructuring, in cl-loop Another feature of the @code{cl-loop} macro is @emph{destructuring}, similar in concept to the destructuring provided by @code{defmacro} (@pxref{Argument Lists}). ------------------------------------------------------------ revno: 113727 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-08-06 20:06:43 -0400 message: * lisp/calendar/calendar.el (calendar-font-lock-keywords): Set to nil diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-06 23:53:49 +0000 +++ lisp/ChangeLog 2013-08-07 00:06:43 +0000 @@ -16,8 +16,7 @@ (calendar-day-abbrev-array): Also :set calendar-day-header-array, and maybe redraw. (calendar-day-header-array): New option. (Bug#15007) - (calendar-font-lock-keywords): Use calendar-day-header-array, - and calendar- faces. Make obsolete. + (calendar-font-lock-keywords): Set to nil and make obsolete. (calendar-day-name): Add option to use header array. 2013-08-06 Lars Magne Ingebrigtsen === modified file 'lisp/calendar/calendar.el' --- lisp/calendar/calendar.el 2013-08-06 23:53:49 +0000 +++ lisp/calendar/calendar.el 2013-08-07 00:06:43 +0000 @@ -2360,26 +2360,7 @@ (+ (* 12 (- yr2 yr1)) (- mon2 mon1))) -(defvar calendar-font-lock-keywords - ;; Month and year. Not really needed now that calendar-month-header - ;; contains propertize, and not correct for non-american forms - ;; of that variable. - `((,(concat (regexp-opt (mapcar 'identity calendar-month-name-array) t) - " -?[0-9]+") - . 'calendar-month-header) - ;; Day headers. - ;; Also not needed now that calendar-generate-month uses propertize. - (,(regexp-opt - (list (truncate-string-to-width (aref calendar-day-header-array 6) - calendar-day-header-width) - (truncate-string-to-width (aref calendar-day-header-array 0) - calendar-day-header-width))) - ;; Saturdays and Sundays are highlighted differently. - . 'calendar-weekend-header) - (,(regexp-opt (mapcar (lambda (x) (truncate-string-to-width - x calendar-day-header-width)) - calendar-day-header-array)) - . 'calendar-day-header)) +(defvar calendar-font-lock-keywords nil "Default keywords to highlight in Calendar mode.") (make-obsolete-variable 'calendar-font-lock-keywords ------------------------------------------------------------ revno: 113726 fixes bug: http://debbugs.gnu.org/15007 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-08-06 19:53:49 -0400 message: calendar.el: Add new faces, and day-header-array * lisp/calendar/calendar.el (calendar-weekday-header) (calendar-weekend-header, calendar-month-header): New faces. (calendar-day-header-construct): New function. (calendar-day-header-width): Also :set calendar-day-header-array. (calendar-american-month-header, calendar-european-month-header) (calendar-iso-month-header): Use calendar- faces. (calendar-generate-month): Use calendar-day-header-array for day headers; apply faces to them. (calendar-mode): Check calendar-font-lock-keywords non-nil. (calendar-abbrev-construct): Add optional maxlen argument. (calendar-day-name-array): Doc fix. (calendar-day-name-array, calendar-abbrev-length) (calendar-day-abbrev-array): Also :set calendar-day-header-array, and maybe redraw. (calendar-day-header-array): New option. (calendar-font-lock-keywords): Use calendar-day-header-array, and calendar- faces. Make obsolete. (calendar-day-name): Add option to use header array. * etc/NEWS: Mention this. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-08-06 20:28:23 +0000 +++ etc/NEWS 2013-08-06 23:53:49 +0000 @@ -233,6 +233,13 @@ ** Calendar and Diary +*** New faces: `calendar-weekday-header', `calendar-weekend-header', +`calendar-month-header'. + +*** New option `calendar-day-header-array'. + +*** The variable `calendar-font-lock-keywords' is obsolete. + +++ *** New variable `diary-from-outlook-function', used by the command `diary-from-outlook'. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-06 22:05:33 +0000 +++ lisp/ChangeLog 2013-08-06 23:53:49 +0000 @@ -1,3 +1,25 @@ +2013-08-06 Glenn Morris + + * calendar/calendar.el: Add new faces, and day-header-array. + (calendar-weekday-header, calendar-weekend-header) + (calendar-month-header): New faces. + (calendar-day-header-construct): New function. + (calendar-day-header-width): Also :set calendar-day-header-array. + (calendar-american-month-header, calendar-european-month-header) + (calendar-iso-month-header): Use calendar- faces. + (calendar-generate-month): + Use calendar-day-header-array for day headers; apply faces to them. + (calendar-mode): Check calendar-font-lock-keywords non-nil. + (calendar-abbrev-construct): Add optional maxlen argument. + (calendar-day-name-array): Doc fix. + (calendar-day-name-array, calendar-abbrev-length) + (calendar-day-abbrev-array): + Also :set calendar-day-header-array, and maybe redraw. + (calendar-day-header-array): New option. (Bug#15007) + (calendar-font-lock-keywords): Use calendar-day-header-array, + and calendar- faces. Make obsolete. + (calendar-day-name): Add option to use header array. + 2013-08-06 Lars Magne Ingebrigtsen * net/shr.el (shr-render-td): Remove debugging. === modified file 'lisp/calendar/calendar.el' --- lisp/calendar/calendar.el 2013-08-05 14:26:57 +0000 +++ lisp/calendar/calendar.el 2013-08-06 23:53:49 +0000 @@ -259,6 +259,23 @@ (define-obsolete-face-alias 'holiday-face 'holiday "22.1") +(defface calendar-weekday-header '((t :inherit font-lock-constant-face)) + "Face used for weekday column headers in the calendar. +See also the face `calendar-weekend-header'." + :version "24.4" + :group 'calendar-faces) + +(defface calendar-weekend-header '((t :inherit font-lock-comment-face)) + "Face used for weekend column headers in the calendar. +See also the face `calendar-weekday-header'." + :version "24.4" + :group 'calendar-faces) + +(defface calendar-month-header '((t :inherit font-lock-function-name-face)) + "Face used for month headers in the calendar." + :version "24.4" + :group 'calendar-faces) + ;; These briefly checked font-lock-mode, but that is broken, since it ;; is a buffer-local variable, and which buffer happens to be current ;; when this file is loaded shouldn't make a difference. One could @@ -447,7 +464,6 @@ (push (cons i (calendar-month-edges i)) calendar-month-edges)) (setq calendar-month-edges (reverse calendar-month-edges))) -;; FIXME add font-lock-keywords. (defun calendar-set-layout-variable (symbol value &optional minmax) "Set SYMBOL's value to VALUE, an integer. A positive/negative MINMAX enforces a minimum/maximum value. @@ -491,12 +507,25 @@ :type 'integer :version "23.1") +(defun calendar-day-header-construct (&optional width) + "Return the default value for `calendar-day-header-array'. +WIDTH defaults to `calendar-day-header-width'." + (or width (setq width calendar-day-header-width)) + (calendar-abbrev-construct (if (<= width calendar-abbrev-length) + calendar-day-abbrev-array + calendar-day-name-array) + width)) + +;; FIXME better to use a format spec? (defcustom calendar-day-header-width 2 "Width of the day column headers in the calendar. Must be at least one less than `calendar-column-width'." :group 'calendar :initialize 'custom-initialize-default :set (lambda (sym val) + (or (calendar-customized-p 'calendar-day-header-array) + (setq calendar-day-header-array + (calendar-day-header-construct val))) (calendar-set-layout-variable sym val (- 1 calendar-column-width))) :type 'integer :version "23.1") @@ -924,33 +953,33 @@ (defcustom calendar-american-month-header '(propertize (format "%s %d" (calendar-month-name month) year) - 'font-lock-face 'font-lock-function-name-face) + 'font-lock-face 'calendar-month-header) "Default format for calendar month headings with the American date style. Normally you should not customize this, but `calender-month-header'." :group 'calendar :risky t :type 'sexp - :version "24.3") + :version "24.4") ; font-lock-function-name-face -> calendar-month-header (defcustom calendar-european-month-header '(propertize (format "%s %d" (calendar-month-name month) year) - 'font-lock-face 'font-lock-function-name-face) + 'font-lock-face 'calendar-month-header) "Default format for calendar month headings with the European date style. Normally you should not customize this, but `calender-month-header'." :group 'calendar :risky t :type 'sexp - :version "24.3") + :version "24.4") ; font-lock-function-name-face -> calendar-month-header (defcustom calendar-iso-month-header '(propertize (format "%d %s" year (calendar-month-name month)) - 'font-lock-face 'font-lock-function-name-face) + 'font-lock-face 'calendar-month-header) "Default format for calendar month headings with the ISO date style. Normally you should not customize this, but `calender-month-header'." :group 'calendar :risky t :type 'sexp - :version "24.3") + :version "24.4") ; font-lock-function-name-face -> calendar-month-header (defcustom calendar-month-header (cond ((eq calendar-date-style 'iso) @@ -1517,8 +1546,7 @@ (last (calendar-last-day-of-month month year)) (trunc (min calendar-intermonth-spacing (1- calendar-left-margin))) - (day 1) - string) + (day 1)) (goto-char (point-min)) (calendar-move-to-column indent) (insert @@ -1526,13 +1554,16 @@ ?\s calendar-month-digit-width)) (calendar-ensure-newline) (calendar-insert-at-column indent calendar-intermonth-header trunc) - ;; Use the first two characters of each day to head the columns. + ;; Use the first N characters of each day to head the columns. (dotimes (i 7) (insert - (progn - (setq string - (calendar-day-name (mod (+ calendar-week-start-day i) 7) nil t)) - (truncate-string-to-width string calendar-day-header-width nil ?\s)) + (truncate-string-to-width + (propertize (calendar-day-name (mod (+ calendar-week-start-day i) 7) + 'header t) + 'font-lock-face (if (memq i '(0 6)) + 'calendar-weekend-header + 'calendar-weekday-header)) + calendar-day-header-width nil ?\s) (make-string (- calendar-column-width calendar-day-header-width) ?\s))) (calendar-ensure-newline) (calendar-insert-at-column indent calendar-intermonth-text trunc) @@ -1808,8 +1839,9 @@ ;; soon in calendar-generate, but better safe than sorry. (unless (boundp 'displayed-month) (setq displayed-month 1)) (unless (boundp 'displayed-year) (setq displayed-year 2001)) - (set (make-local-variable 'font-lock-defaults) - '(calendar-font-lock-keywords t))) + (if (bound-and-true-p calendar-font-lock-keywords) + (set (make-local-variable 'font-lock-defaults) + '(calendar-font-lock-keywords t)))) (defun calendar-string-spread (strings char length) "Concatenate list of STRINGS separated with copies of CHAR to fill LENGTH. @@ -2079,33 +2111,41 @@ (and standard (not (equal (eval (car standard)) (default-value symbol))))))) -(defun calendar-abbrev-construct (full) +(defun calendar-abbrev-construct (full &optional maxlen) "From sequence FULL, return a vector of abbreviations. -Each abbreviation is no longer than `calendar-abbrev-length' characters." +Each abbreviation is no longer than MAXLEN (default `calendar-abbrev-length') +characters." + (or maxlen (setq maxlen calendar-abbrev-length)) (apply 'vector (mapcar (lambda (f) - (substring f 0 (min calendar-abbrev-length (length f)))) + ;; TODO? truncate-string-to-width? + (substring f 0 (min maxlen (length f)))) full))) (defcustom calendar-day-name-array ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"] "Array of capitalized strings giving, in order from Sunday, the day names. -The first two characters of each string will be used to head the -day columns in the calendar. If you change this without using customize after the calendar has loaded, -then you may also want to change `calendar-day-abbrev-array'." +then you may also want to change `calendar-day-abbrev-array' +and `calendar-day-header-array'." :group 'calendar :initialize 'custom-initialize-default :set (lambda (symbol value) (let ((dcustomized (calendar-customized-p 'calendar-day-abbrev-array)) - (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array))) + (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array)) + (ccustomized (calendar-customized-p 'calendar-day-header-array))) (set symbol value) (or dcustomized (setq calendar-day-abbrev-array (calendar-abbrev-construct calendar-day-name-array))) (and (not hcustomized) (boundp 'cal-html-day-abbrev-array) - (setq cal-html-day-abbrev-array calendar-day-abbrev-array)))) + (setq cal-html-day-abbrev-array calendar-day-abbrev-array)) + (or ccustomized + (equal calendar-day-header-array + (setq calendar-day-header-array + (calendar-day-header-construct))) + (calendar-redraw)))) :type '(vector (string :tag "Sunday") (string :tag "Monday") (string :tag "Tuesday") @@ -2125,7 +2165,8 @@ (let ((dcustomized (calendar-customized-p 'calendar-day-abbrev-array)) (mcustomized (calendar-customized-p 'calendar-month-abbrev-array)) - (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array))) + (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array)) + (ccustomized (calendar-customized-p 'calendar-day-header-array))) (set symbol value) (or dcustomized (setq calendar-day-abbrev-array @@ -2135,7 +2176,12 @@ (calendar-abbrev-construct calendar-month-name-array))) (and (not hcustomized) (boundp 'cal-html-day-abbrev-array) - (setq cal-html-day-abbrev-array calendar-day-abbrev-array)))) + (setq cal-html-day-abbrev-array calendar-day-abbrev-array)) + (or ccustomized + (equal calendar-day-header-array + (setq calendar-day-header-array + (calendar-day-header-construct))) + (calendar-redraw)))) :type 'integer) (defcustom calendar-day-abbrev-array @@ -2152,11 +2198,17 @@ :initialize 'custom-initialize-default :set-after '(calendar-abbrev-length calendar-day-name-array) :set (lambda (symbol value) - (let ((hcustomized (calendar-customized-p 'cal-html-day-abbrev-array))) + (let ((hcustomized (calendar-customized-p 'cal-html-day-abbrev-array)) + (ccustomized (calendar-customized-p 'calendar-day-header-array))) (set symbol value) (and (not hcustomized) (boundp 'cal-html-day-abbrev-array) - (setq cal-html-day-abbrev-array calendar-day-abbrev-array)))) + (setq cal-html-day-abbrev-array calendar-day-abbrev-array)) + (or ccustomized + (equal calendar-day-header-array + (setq calendar-day-header-array + (calendar-day-header-construct))) + (calendar-redraw)))) :type '(vector (string :tag "Sun") (string :tag "Mon") (string :tag "Tue") @@ -2167,6 +2219,33 @@ ;; Made defcustom, changed defaults from nil nil... :version "24.1") +(defcustom calendar-day-header-array (calendar-day-header-construct) + "Array of strings to use for the headers of the calendar's day columns. +The order should be the same as in `calendar-day-name-array'. +In use, the calendar truncates elements to no more than +`calendar-day-header-width' columns wide. +Emacs constructs the default from either `calendar-day-name-array' +\(if `calendar-day-header-width' is more than `calendar-abbrev-length'), +or from `calendar-day-abbrev-array' (assuming that the abbreviated +name are more likely to be unique when truncated)." + :group 'calendar + :initialize 'custom-initialize-default + :set-after '(calendar-day-header-width + calendar-abbrev-length calendar-day-name-array + calendar-day-abbrev-array) + :set (lambda (symbol value) + (or (equal calendar-day-header-array + (set symbol value)) + (calendar-redraw))) + :type '(vector (string :tag "Su") + (string :tag "Mo") + (string :tag "Tu") + (string :tag "We") + (string :tag "Th") + (string :tag "Fr") + (string :tag "Sa")) + :version "24.4") + (defcustom calendar-month-name-array ["January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December"] @@ -2287,30 +2366,38 @@ ;; of that variable. `((,(concat (regexp-opt (mapcar 'identity calendar-month-name-array) t) " -?[0-9]+") - . font-lock-function-name-face) + . 'calendar-month-header) + ;; Day headers. + ;; Also not needed now that calendar-generate-month uses propertize. (,(regexp-opt - (list (truncate-string-to-width (aref calendar-day-name-array 6) + (list (truncate-string-to-width (aref calendar-day-header-array 6) calendar-day-header-width) - (truncate-string-to-width (aref calendar-day-name-array 0) + (truncate-string-to-width (aref calendar-day-header-array 0) calendar-day-header-width))) ;; Saturdays and Sundays are highlighted differently. - . font-lock-comment-face) - ;; First two chars of each day are used in the calendar. - (,(regexp-opt (mapcar (lambda (x) (truncate-string-to-width - x calendar-day-header-width)) - calendar-day-name-array)) - . font-lock-constant-face)) + . 'calendar-weekend-header) + (,(regexp-opt (mapcar (lambda (x) (truncate-string-to-width + x calendar-day-header-width)) + calendar-day-header-array)) + . 'calendar-day-header)) "Default keywords to highlight in Calendar mode.") +(make-obsolete-variable 'calendar-font-lock-keywords + "set font-lock keywords in `calendar-mode-hook', \ +or customize calendar faces." "24.4") + (defun calendar-day-name (date &optional abbrev absolute) "Return a string with the name of the day of the week of DATE. DATE should be a list in the format (MONTH DAY YEAR), unless the optional argument ABSOLUTE is non-nil, in which case DATE should be an integer in the range 0 to 6 corresponding to the day of the week. Day names are taken from the variable `calendar-day-name-array', -unless the optional argument ABBREV is non-nil, in which case -the variable `calendar-day-abbrev-array' is used." - (aref (if abbrev calendar-day-abbrev-array calendar-day-name-array) +unless the optional argument ABBREV is non-nil: +`header' means to use `calendar-day-header-array'; +t to use `calendar-day-abbrev-array'." + (aref (cond ((eq abbrev 'header) calendar-day-header-array) + (abbrev calendar-day-abbrev-array) + (t calendar-day-name-array)) (if absolute date (calendar-day-of-week date)))) (defun calendar-month-name (month &optional abbrev) ------------------------------------------------------------ revno: 113725 author: Jan Tatarik committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2013-08-06 22:09:27 +0000 message: gnus-icalendar.el (gnus-icalendar-event-from-ical): Replace pcase with cond for backwards compatability diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-08-06 13:52:59 +0000 +++ lisp/gnus/ChangeLog 2013-08-06 22:09:27 +0000 @@ -1,3 +1,8 @@ +2013-08-06 Jan Tatarik + + * gnus-icalendar.el (gnus-icalendar-event-from-ical): Replace pcase + with cond for backwards compatability. + 2013-08-06 Katsumi Yamaoka * mm-decode.el (mm-display-external): Bind process-connection-type to === modified file 'lisp/gnus/gnus-icalendar.el' --- lisp/gnus/gnus-icalendar.el 2013-08-01 22:58:40 +0000 +++ lisp/gnus/gnus-icalendar.el 2013-08-06 22:09:27 +0000 @@ -183,11 +183,11 @@ :end (gnus-icalendar-event--decode-datefield event 'DTEND zone-map) :rsvp (string= (plist-get (cadr attendee) 'RSVP) "TRUE"))) - (event-class (pcase method - ("REQUEST" 'gnus-icalendar-event-request) - ("CANCEL" 'gnus-icalendar-event-cancel) - ("REPLY" 'gnus-icalendar-event-reply) - (_ 'gnus-icalendar-event)))) + (event-class (cond + ((string= method "REQUEST") 'gnus-icalendar-event-request) + ((string= method "CANCEL") 'gnus-icalendar-event-cancel) + ((string= method "REPLY") 'gnus-icalendar-event-reply) + (t 'gnus-icalendar-event)))) (labels ((map-property (prop) (let ((value (icalendar--get-event-property event prop))) @@ -252,14 +252,15 @@ ;; NOTE: not all of the below fields are mandatory, ;; but they are often present in other clients' ;; replies. Can be helpful for debugging, too. - (new-line (pcase key - ("ATTENDEE" (update-attendee-status line)) - ("SUMMARY" (update-summary line)) - ("DTSTAMP" (update-dtstamp)) - ((or "ORGANIZER" "DTSTART" "DTEND" - "LOCATION" "DURATION" "SEQUENCE" - "RECURRENCE-ID" "UID") line) - (_ nil)))) + (new-line + (cond + ((string= key "ATTENDEE") (update-attendee-status line)) + ((string= key "SUMMARY") (update-summary line)) + ((string= key "DTSTAMP") (update-dtstamp)) + ((find key '("ORGANIZER" "DTSTART" "DTEND" + "LOCATION" "DURATION" "SEQUENCE" + "RECURRENCE-ID" "UID")) line) + (t nil)))) (when new-line (push new-line reply-event-lines)))))) @@ -405,7 +406,8 @@ (defun gnus-icalendar--deactivate-org-timestamp (ts) (replace-regexp-in-string "[<>]" - (lambda (m) (pcase m ("<" "[") (">" "]"))) + (lambda (m) (cond ((string= m "<") "[") + ((string= m ">") "]"))) ts)) (defun gnus-icalendar-find-org-event-file (event &optional org-file) ------------------------------------------------------------ revno: 113724 committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Wed 2013-08-07 00:05:33 +0200 message: Further shr width computation fixes (shr-make-table-1): Redo last change to fix the real problem in colspan handling. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-06 21:28:38 +0000 +++ lisp/ChangeLog 2013-08-06 22:05:33 +0000 @@ -4,6 +4,8 @@ (shr-render-td): Make width computation consistent by defaulting all zero-width columns to 10 characters. This may not be optimal, but it's at least consistent. + (shr-make-table-1): Redo last change to fix the real problem in + colspan handling. 2013-08-06 Dmitry Antipov === modified file 'lisp/net/shr.el' --- lisp/net/shr.el 2013-08-06 21:28:38 +0000 +++ lisp/net/shr.el 2013-08-06 22:05:33 +0000 @@ -1488,7 +1488,11 @@ 10)) (when (and fill (setq colspan (cdr (assq :colspan (cdr column))))) - (setq colspan (string-to-number colspan)) + (setq colspan (min (string-to-number colspan) + ;; The colspan may be wrong, so + ;; truncate it to the length of the + ;; remaining columns. + (- (length widths) i))) (dotimes (j (1- colspan)) (if (> (+ i 1 j) (1- (length widths))) (setq width (aref widths (1- (length widths)))) @@ -1496,9 +1500,6 @@ shr-table-separator-length (aref widths (+ i 1 j)))))) (setq width-column (+ width-column (1- colspan)))) - ;; Sanity check for degenerate tables. - (when (zerop width) - (setq width 10)) (when (or column (not fill)) (push (shr-render-td (cdr column) width fill) @@ -1576,7 +1577,7 @@ (split-string (buffer-string) "\n") nil (car actual-colors)) - (max max 10)))))) + max))))) (defun shr-buffer-width () (goto-char (point-min)) ------------------------------------------------------------ revno: 113723 committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Tue 2013-08-06 23:28:38 +0200 message: shr table rendering touch-ups * net/shr.el (shr-render-td): Remove debugging. (shr-render-td): Make width computation consistent by defaulting all zero-width columns to 10 characters. This may not be optimal, but it's at least consistent. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-06 16:33:14 +0000 +++ lisp/ChangeLog 2013-08-06 21:28:38 +0000 @@ -1,3 +1,10 @@ +2013-08-06 Lars Magne Ingebrigtsen + + * net/shr.el (shr-render-td): Remove debugging. + (shr-render-td): Make width computation consistent by defaulting + all zero-width columns to 10 characters. This may not be optimal, + but it's at least consistent. + 2013-08-06 Dmitry Antipov * files.el (cache-long-line-scans): Make === modified file 'lisp/net/shr.el' --- lisp/net/shr.el 2013-07-30 14:58:37 +0000 +++ lisp/net/shr.el 2013-08-06 21:28:38 +0000 @@ -1496,11 +1496,11 @@ shr-table-separator-length (aref widths (+ i 1 j)))))) (setq width-column (+ width-column (1- colspan)))) + ;; Sanity check for degenerate tables. + (when (zerop width) + (setq width 10)) (when (or column (not fill)) - ;; Sanity check for degenerate tables. - (when (zerop width) - (setq width 10)) (push (shr-render-td (cdr column) width fill) tds)) (setq i (1+ i) @@ -1509,7 +1509,6 @@ (nreverse trs))) (defun shr-render-td (cont width fill) - (when (= width 0) (debug)) (with-temp-buffer (let ((bgcolor (cdr (assq :bgcolor cont))) (fgcolor (cdr (assq :fgcolor cont))) @@ -1577,7 +1576,7 @@ (split-string (buffer-string) "\n") nil (car actual-colors)) - max))))) + (max max 10)))))) (defun shr-buffer-width () (goto-char (point-min)) ------------------------------------------------------------ revno: 113722 committer: Stephen Berman branch nick: trunk timestamp: Tue 2013-08-06 22:28:23 +0200 message: * NEWS: Mention Todo mode user manual. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-08-06 16:33:14 +0000 +++ etc/NEWS 2013-08-06 20:28:23 +0000 @@ -432,6 +432,7 @@ archive files, undoing or unarchiving done items; - reprioritizing items by inputting a numerical priority; - extensive customizability of operation and display, including numerous faces. +The Todo mode user manual describes all commands and most user options. To support some of these features, a new file format is used, which is incompatible with the old format; however, you can convert old todo and done item files to the new format on initializing the first new todo file, or at any ------------------------------------------------------------ revno: 113721 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2013-08-06 20:51:41 +0400 message: * window.c (window_scroll, window_scroll_pixel_based) (window_scroll_line_based): Use bool for booleans. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-06 14:17:25 +0000 +++ src/ChangeLog 2013-08-06 16:51:41 +0000 @@ -1,3 +1,8 @@ +2013-08-06 Dmitry Antipov + + * window.c (window_scroll, window_scroll_pixel_based) + (window_scroll_line_based): Use bool for booleans. + 2013-08-06 Paul Eggert * process.c: Fix minor off-by-one issues in descriptor counts. === modified file 'src/window.c' --- src/window.c 2013-08-03 03:29:03 +0000 +++ src/window.c 2013-08-06 16:51:41 +0000 @@ -66,9 +66,9 @@ static int displayed_window_lines (struct window *); static int count_windows (struct window *); static int get_leaf_windows (struct window *, struct window **, int); -static void window_scroll (Lisp_Object, EMACS_INT, int, int); -static void window_scroll_pixel_based (Lisp_Object, int, int, int); -static void window_scroll_line_based (Lisp_Object, int, int, int); +static void window_scroll (Lisp_Object, EMACS_INT, bool, int); +static void window_scroll_pixel_based (Lisp_Object, int, bool, int); +static void window_scroll_line_based (Lisp_Object, int, bool, int); static int freeze_window_start (struct window *, void *); static Lisp_Object window_list (void); static int add_window_to_list (struct window *, void *); @@ -4336,7 +4336,7 @@ respectively. */ static void -window_scroll (Lisp_Object window, EMACS_INT n, int whole, int noerror) +window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror) { immediate_quit = 1; n = clip_to_bounds (INT_MIN, n, INT_MAX); @@ -4357,7 +4357,7 @@ descriptions. */ static void -window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) +window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) { struct it it; struct window *w = XWINDOW (window); @@ -4725,7 +4725,7 @@ See the comment of window_scroll for parameter descriptions. */ static void -window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) +window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror) { register struct window *w = XWINDOW (window); /* Fvertical_motion enters redisplay, which can trigger @@ -4737,7 +4737,7 @@ register ptrdiff_t pos, pos_byte; register int ht = window_internal_height (w); register Lisp_Object tem; - int lose; + bool lose; Lisp_Object bolp; ptrdiff_t startpos = marker_position (w->start); ptrdiff_t startbyte = marker_byte_position (w->start); ------------------------------------------------------------ revno: 113720 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2013-08-06 20:33:14 +0400 message: * lisp/files.el (cache-long-line-scans): Make obsolete alias to `cache-long-scans'. * etc/NEWS: Mention `cache-long-scans'. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2013-08-05 16:29:09 +0000 +++ etc/ChangeLog 2013-08-06 16:33:14 +0000 @@ -1,3 +1,7 @@ +2013-08-06 Dmitry Antipov + + * NEWS: Mention `cache-long-scans'. + 2013-08-05 Juanma Barranquero * tutorials/TUTORIAL.es: Fix typo (bug#15027). === modified file 'etc/NEWS' --- etc/NEWS 2013-08-04 20:18:11 +0000 +++ etc/NEWS 2013-08-06 16:33:14 +0000 @@ -54,6 +54,10 @@ ** Key ? also describes prefix bindings like C-h. +++ +** `cache-long-line-scans' has been renamed to `cache-long-scans' +because it affects caching of paragraph scanning results as well. + ++++ ** `apropos-variable' is now `apropos-user-option' `apropos-user-option' shows all user options while `apropos-variable' shows all variables. When called with a universal prefix argument, === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-06 12:18:43 +0000 +++ lisp/ChangeLog 2013-08-06 16:33:14 +0000 @@ -1,3 +1,8 @@ +2013-08-06 Dmitry Antipov + + * files.el (cache-long-line-scans): Make + obsolete alias to `cache-long-scans'. + 2013-08-06 Juanma Barranquero * frameset.el (frameset, frameset-filter-alist) === modified file 'lisp/files.el' --- lisp/files.el 2013-08-01 23:18:37 +0000 +++ lisp/files.el 2013-08-06 16:33:14 +0000 @@ -6690,7 +6690,9 @@ (string-to-number value 8) (file-modes-symbolic-to-number value modes))))) - +(define-obsolete-variable-alias 'cache-long-line-scans + 'cache-long-scans "24.4") + ;; Trashcan handling. (defcustom trash-directory nil "Directory for `move-file-to-trash' to move files and directories to. ------------------------------------------------------------ revno: 113719 committer: Paul Eggert branch nick: trunk timestamp: Tue 2013-08-06 07:17:25 -0700 message: * process.c: Fix minor off-by-one issues in descriptor counts. This shouldn't fix any real bugs, but it cleans up the code a bit. (max_process_desc, max_input_desc): -1, not 0, means none. All uses changed. (delete_input_desc): New function. (delete_write_fd, delete_keyboard_wait_descriptor): Use it. (deactivate_process): Scan backwards when recomuting max_process_desc; that should be faster. (init_process_emacs): Initialize max_input_desc. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-06 06:53:09 +0000 +++ src/ChangeLog 2013-08-06 14:17:25 +0000 @@ -1,3 +1,15 @@ +2013-08-06 Paul Eggert + + * process.c: Fix minor off-by-one issues in descriptor counts. + This shouldn't fix any real bugs, but it cleans up the code a bit. + (max_process_desc, max_input_desc): -1, not 0, means none. + All uses changed. + (delete_input_desc): New function. + (delete_write_fd, delete_keyboard_wait_descriptor): Use it. + (deactivate_process): Scan backwards when recomuting max_process_desc; + that should be faster. + (init_process_emacs): Initialize max_input_desc. + 2013-08-06 Dmitry Antipov Use region cache to speedup bidi_find_paragraph_start. === modified file 'src/process.c' --- src/process.c 2013-07-26 18:48:05 +0000 +++ src/process.c 2013-08-06 14:17:25 +0000 @@ -323,10 +323,10 @@ static int num_pending_connects; #endif /* NON_BLOCKING_CONNECT */ -/* The largest descriptor currently in use for a process object. */ +/* The largest descriptor currently in use for a process object; -1 if none. */ static int max_process_desc; -/* The largest descriptor currently in use for input. */ +/* The largest descriptor currently in use for input; -1 if none. */ static int max_input_desc; /* Indexed by descriptor, gives the process (if any) for that descriptor */ @@ -500,13 +500,27 @@ fd_callback_info[fd].condition |= FOR_WRITE; } +/* FD is no longer an input descriptor; update max_input_desc accordingly. */ + +static void +delete_input_desc (int fd) +{ + if (fd == max_input_desc) + { + do + fd--; + while (0 <= fd && ! (FD_ISSET (fd, &input_wait_mask) + || FD_ISSET (fd, &write_mask))); + + max_input_desc = fd; + } +} + /* Stop monitoring file descriptor FD for when write is possible. */ void delete_write_fd (int fd) { - int lim = max_input_desc; - eassert (fd < MAXDESC); FD_CLR (fd, &write_mask); fd_callback_info[fd].condition &= ~FOR_WRITE; @@ -514,15 +528,7 @@ { fd_callback_info[fd].func = 0; fd_callback_info[fd].data = 0; - - if (fd == max_input_desc) - for (fd = lim; fd >= 0; fd--) - if (FD_ISSET (fd, &input_wait_mask) || FD_ISSET (fd, &write_mask)) - { - max_input_desc = fd; - break; - } - + delete_input_desc (fd); } } @@ -3831,13 +3837,14 @@ #endif if (inchannel == max_process_desc) { - int i; /* We just closed the highest-numbered process input descriptor, so recompute the highest-numbered one now. */ - max_process_desc = 0; - for (i = 0; i < MAXDESC; i++) - if (!NILP (chan_process[i])) - max_process_desc = i; + int i = inchannel; + do + i--; + while (0 <= i && NILP (chan_process[i])); + + max_process_desc = i; } } } @@ -6763,16 +6770,9 @@ delete_keyboard_wait_descriptor (int desc) { #ifdef subprocesses - int fd; - int lim = max_input_desc; - FD_CLR (desc, &input_wait_mask); FD_CLR (desc, &non_process_wait_mask); - - if (desc == max_input_desc) - for (fd = 0; fd < lim; fd++) - if (FD_ISSET (fd, &input_wait_mask) || FD_ISSET (fd, &write_mask)) - max_input_desc = fd; + delete_input_desc (desc); #endif } @@ -7037,7 +7037,7 @@ FD_ZERO (&non_keyboard_wait_mask); FD_ZERO (&non_process_wait_mask); FD_ZERO (&write_mask); - max_process_desc = 0; + max_process_desc = max_input_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); #ifdef NON_BLOCKING_CONNECT ------------------------------------------------------------ revno: 113718 committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2013-08-06 13:52:59 +0000 message: lisp/gnus/mm-decode.el (mm-display-external): Work for xdg-open diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-08-05 14:15:37 +0000 +++ lisp/gnus/ChangeLog 2013-08-06 13:52:59 +0000 @@ -1,3 +1,10 @@ +2013-08-06 Katsumi Yamaoka + + * mm-decode.el (mm-display-external): Bind process-connection-type to + nil; don't delete a temp file immediately even if a viewer finishes, + since it may be a shell script, like xdg-open, that launches a real + viewer program belatedly. + 2013-08-05 Dave Abrahams * gnus-int.el (gnus-warp-to-article): Allow warping in all groups so === modified file 'lisp/gnus/mm-decode.el' --- lisp/gnus/mm-decode.el 2013-08-01 22:58:40 +0000 +++ lisp/gnus/mm-decode.el 2013-08-06 13:52:59 +0000 @@ -962,7 +962,7 @@ (let ((command (mm-mailcap-command method file (mm-handle-type handle)))) (unwind-protect - (progn + (let ((process-connection-type nil)) (start-process "*display*" (setq buffer (generate-new-buffer " *mm*")) @@ -984,12 +984,13 @@ (delete-directory (file-name-directory file))))) (lambda (process state) (when (eq (process-status process) 'exit) - (condition-case nil - (delete-file file) - (error)) - (condition-case nil - (delete-directory (file-name-directory file)) - (error)) + (run-at-time + 10.0 nil + (lambda () + (ignore-errors + (delete-file file)) + (ignore-errors + (delete-directory (file-name-directory file))))) (when (buffer-live-p outbuf) (with-current-buffer outbuf (let ((buffer-read-only nil) ------------------------------------------------------------ revno: 113717 committer: Juanma Barranquero branch nick: trunk timestamp: Tue 2013-08-06 14:18:43 +0200 message: lisp/frameset.el: Doc fixes. (frameset, frameset-filter-alist, frameset-filter-params, frameset-save) (frameset--reuse-frame, frameset--minibufferless-last-p, frameset-restore): Doc fixes. (frameset-compute-pos): Rename from frameset--compute-pos, and add docstring. (frameset-move-onscreen): Use frameset-compute-pos. Most changes suggested by Drew Adams . diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-06 12:12:33 +0000 +++ lisp/ChangeLog 2013-08-06 12:18:43 +0000 @@ -1,5 +1,13 @@ 2013-08-06 Juanma Barranquero + * frameset.el (frameset, frameset-filter-alist) + (frameset-filter-params, frameset-save, frameset--reuse-frame) + (frameset--minibufferless-last-p, frameset-restore): Doc fixes. + (frameset-compute-pos): Rename from frameset--compute-pos, + and add docstring. + (frameset-move-onscreen): Use frameset-compute-pos. + Most changes suggested by Drew Adams . + * find-lisp.el (find-lisp-line-indent, find-lisp-find-dired-filter): Fix typos in docstrings. === modified file 'lisp/frameset.el' --- lisp/frameset.el 2013-08-06 01:26:29 +0000 +++ lisp/frameset.el 2013-08-06 12:18:43 +0000 @@ -42,9 +42,12 @@ (cl-defstruct (frameset (:type list) :named + ;; Copier and predicate functions are defined below. (:copier nil) (:predicate nil) ;; A BOA constructor, not the default "keywordy" one. + ;; This is for internal use; to create a frameset, + ;; the "right" way to do it is with frameset-save. (:constructor make-frameset (properties states))) "A frameset encapsulates a serializable view of a set of frames and windows. @@ -55,11 +58,10 @@ version A non-modifiable version number, identifying the format of the frameset struct. Currently its value is 1. properties A property list, to store both frameset-specific and - user-defined serializable data (some suggested properties - are described below). + user-defined serializable data (see suggestions below). states An alist of items (FRAME-PARAMETERS . WINDOW-STATE), in no particular order. Each item represents a frame to be - restored. FRAME-PARAMETERS is a frame's parameter list, + restored. FRAME-PARAMETERS is a frame's parameter alist, extracted with (frame-parameters FRAME) and filtered through `frame-parameters-alist' or a similar filter alist. WINDOW-STATE is the output of `window-state-get', when @@ -75,10 +77,14 @@ :desc TEXT A description for user consumption (to show in a menu to choose among framesets, etc.); a string. +To avoid collisions, it is recommended that applications wanting to add +private serializable data to `properties' either store all info under a +single, distinctive name, or use property names with a well-chosen prefix. + A frameset is intended to be used through the following simple API: - - `frameset-save' captures all or a subset of the live frames, and returns - a serializable snapshot of them (a frameset). + - `frameset-save', the type's constructor, captures all or a subset of the + live frames, and returns a serializable snapshot of them (a frameset). - `frameset-restore' takes a frameset, and restores the frames and windows it describes, as faithfully as possible. - `frameset-p' is the predicate for the frameset type. It returns nil @@ -166,15 +172,15 @@ This alist is the default value of the :filters arguments of `frameset-save' and `frameset-restore' (which see). On saving, -PARAMETERS is the parameter list of each frame processed, and -FILTERED is the parameter list that gets saved to the frameset. -On restoring, PARAMETERS is the parameter list extracted from the -frameset, and FILTERED is the resulting frame parameter list used +PARAMETERS is the parameter alist of each frame processed, and +FILTERED is the parameter alist that gets saved to the frameset. +On restoring, PARAMETERS is the parameter alist extracted from the +frameset, and FILTERED is the resulting frame parameter alist used to restore the frame. -Elements of this alist are conses (PARAM . ACTION), where PARAM -is a parameter name (a symbol identifying a frame parameter), and -ACTION can be: +Elements of `frameset-filter-alist' are conses (PARAM . ACTION), +where PARAM is a parameter name (a symbol identifying a frame +parameter), and ACTION can be: nil The parameter is copied to FILTERED. :never The parameter is never copied to FILTERED. @@ -183,8 +189,11 @@ FILTER A filter function. FILTER can be a symbol FILTER-FUN, or a list (FILTER-FUN ARGS...). -FILTER-FUN is called with four arguments CURRENT, FILTERED, PARAMETERS and -SAVING, plus any additional ARGS: +FILTER-FUN is invoked with + + (apply FILTER-FUN CURRENT FILTERED PARAMETERS SAVING ARGS) + +where CURRENT A cons (PARAM . VALUE), where PARAM is the one being filtered and VALUE is its current value. @@ -192,6 +201,7 @@ PARAMETERS The complete alist of parameters being filtered, SAVING Non-nil if filtering before saving state, nil if filtering before restoring it. + ARGS Any additional arguments specified in the ACTION. FILTER-FUN is allowed to modify items in FILTERED, but no other arguments. It must return: @@ -308,15 +318,15 @@ (not (and saving (eq (cdr (assq 'visibility parameters)) 'icon)))) (defun frameset-filter-params (parameters filter-alist saving) - "Filter parameter list PARAMETERS and return a filtered list. + "Filter parameter alist PARAMETERS and return a filtered alist. FILTER-ALIST is an alist of parameter filters, in the format of `frameset-filter-alist' (which see). SAVING is non-nil while filtering parameters to save a frameset, nil while the filtering is done to restore it." (let ((filtered nil)) (dolist (current parameters) - ;; When saving, the parameter list is temporary, so modifying it - ;; is not a problem. When restoring, the parameter list is part + ;; When saving, the parameter alist is temporary, so modifying it + ;; is not a problem. When restoring, the parameter alist is part ;; of a frameset, so we must copy parameters to avoid inadvertent ;; modifications. (pcase (cdr (assq (car current) filter-alist)) @@ -417,9 +427,9 @@ "Return the frameset of FRAME-LIST, a list of frames. Dead frames and non-frame objects are silently removed from the list. If nil, FRAME-LIST defaults to the output of `frame-list' (all live frames). -FILTERS is an alist of parameter filters; defaults to `frameset-filter-alist'. +FILTERS is an alist of parameter filters, or `frameset-filter-alist' if nil. PREDICATE is a predicate function, which must return non-nil for frames that -should be saved; it defaults to saving all frames from FRAME-LIST. +should be saved; if PREDICATE is nil, all frames from FRAME-LIST are saved. PROPERTIES is a user-defined property list to add to the frameset." (let* ((list (or (copy-sequence frame-list) (frame-list))) (frames (cl-delete-if-not #'frame-live-p @@ -445,7 +455,16 @@ Its value is only meaningful during execution of `frameset-restore'. Internal use only.") -(defun frameset--compute-pos (value left/top right/bottom) +(defun frameset-compute-pos (value left/top right/bottom) + "Return an absolute positioning value for a frame. +VALUE is the value of a positional frame parameter (`left' or `top'). +If VALUE is relative to the screen edges (like (+ -35) or (-200), it is +converted to absolute by adding it to the corresponding edge; if it is +an absolute position, it is returned unmodified. +LEFT/TOP and RIGHT/BOTTOM indicate the dimensions of the screen in +pixels along the relevant direction: either the position of the left +and right edges for a `left' positional parameter, or the position of +the top and bottom edges for a `top' parameter." (pcase value (`(+ ,val) (+ left/top val)) (`(- ,val) (+ right/bottom val)) @@ -460,8 +479,8 @@ (pcase-let* ((`(,left ,top ,width ,height) (cl-cdadr (frame-monitor-attributes frame))) (right (+ left width -1)) (bottom (+ top height -1)) - (fr-left (frameset--compute-pos (frame-parameter frame 'left) left right)) - (fr-top (frameset--compute-pos (frame-parameter frame 'top) top bottom)) + (fr-left (frameset-compute-pos (frame-parameter frame 'left) left right)) + (fr-top (frameset-compute-pos (frame-parameter frame 'top) top bottom)) (ch-width (frame-char-width frame)) (ch-height (frame-char-height frame)) (fr-width (max (frame-pixel-width frame) (* ch-width (frame-width frame)))) @@ -529,7 +548,7 @@ (defun frameset--reuse-frame (display frame-cfg) "Look for an existing frame to reuse. DISPLAY is the display where the frame will be shown, and FRAME-CFG -is the parameter list of the frame being restored. Internal use only." +is the parameter alist of the frame being restored. Internal use only." (let ((frame nil) mini) ;; There are no fancy heuristics there. We could implement some @@ -591,7 +610,7 @@ (defun frameset--restore-frame (frame-cfg window-cfg filters force-onscreen) "Set up and return a frame according to its saved state. That means either reusing an existing frame or creating one anew. -FRAME-CFG is the frame's parameter list; WINDOW-CFG is its window state. +FRAME-CFG is the frame's parameter alist; WINDOW-CFG is its window state. For the meaning of FILTERS and FORCE-ONSCREEN, see `frameset-restore'. Internal use only." (let* ((fullscreen (cdr (assq 'fullscreen frame-cfg))) @@ -631,7 +650,7 @@ ;; If a frame needs to be created and it falls partially or fully offscreen, ;; sometimes it gets "pushed back" onscreen; however, moving it afterwards is ;; allowed. So we create the frame as invisible and then reapply the full - ;; parameter list (including position and size parameters). + ;; parameter alist (including position and size parameters). (setq frame (or (and frameset--reuse-list (frameset--reuse-frame display filtered-cfg)) (make-frame-on-display display @@ -659,7 +678,8 @@ (defun frameset--minibufferless-last-p (state1 state2) "Predicate to sort frame states in an order suitable for creating frames. -It sorts minibuffer-owning frames before minibufferless ones." +It sorts minibuffer-owning frames before minibufferless ones. +Internal use only." (pcase-let ((`(,hasmini1 ,id-def1) (assq 'frameset--mini (car state1))) (`(,hasmini2 ,id-def2) (assq 'frameset--mini (car state2)))) (cond ((eq id-def1 t) t) @@ -697,9 +717,9 @@ t Frames are restored in the current display. nil Frames are restored, if possible, in their original displays. :delete Frames in other displays are deleted instead of restored. - PRED A function called with one argument, the parameter list; + PRED A function called with one argument, the parameter alist; it must return t, nil or `:delete', as above but affecting - only the frame that will be created from that parameter list. + only the frame that will be created from that parameter alist. FORCE-ONSCREEN can be: t Force onscreen only those frames that are fully offscreen. ------------------------------------------------------------ revno: 113716 committer: Juanma Barranquero branch nick: trunk timestamp: Tue 2013-08-06 14:12:33 +0200 message: lisp/find-lisp.el: Fix typos in docstrings. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-06 10:59:39 +0000 +++ lisp/ChangeLog 2013-08-06 12:12:33 +0000 @@ -1,3 +1,8 @@ +2013-08-06 Juanma Barranquero + + * find-lisp.el (find-lisp-line-indent, find-lisp-find-dired-filter): + Fix typos in docstrings. + 2013-08-06 Dmitry Antipov * frame.el (get-other-frame): Tiny cleanup. === modified file 'lisp/find-lisp.el' --- lisp/find-lisp.el 2013-01-01 09:11:05 +0000 +++ lisp/find-lisp.el 2013-08-06 12:12:33 +0000 @@ -53,7 +53,7 @@ "Internal variable.") (defconst find-lisp-line-indent " " - "Indentation for dired file lines.") + "Indentation for Dired file lines.") (defvar find-lisp-file-predicate nil "Predicate for choosing to include files.") @@ -280,7 +280,7 @@ ;;;###autoload (defun find-lisp-find-dired-filter (regexp) - "Change the filter on a find-lisp-find-dired buffer to REGEXP." + "Change the filter on a `find-lisp-find-dired' buffer to REGEXP." (interactive "sSet filter to regexp: ") (setq find-lisp-regexp regexp) (revert-buffer)) ------------------------------------------------------------ revno: 113715 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2013-08-06 14:59:39 +0400 message: * frame.el (get-other-frame): Tiny cleanup. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-06 09:38:41 +0000 +++ lisp/ChangeLog 2013-08-06 10:59:39 +0000 @@ -1,3 +1,7 @@ +2013-08-06 Dmitry Antipov + + * frame.el (get-other-frame): Tiny cleanup. + 2013-08-06 Juanma Barranquero * vc/vc.el (vc-default-ignore-completion-table): === modified file 'lisp/frame.el' --- lisp/frame.el 2013-08-05 10:35:55 +0000 +++ lisp/frame.el 2013-08-06 10:59:39 +0000 @@ -500,10 +500,7 @@ "Return some frame other than the current frame. Create one if necessary. Note that the minibuffer frame, if separate, is not considered (see `next-frame')." - (let ((s (if (equal (next-frame (selected-frame)) (selected-frame)) - (make-frame) - (next-frame (selected-frame))))) - s)) + (if (equal (next-frame) (selected-frame)) (make-frame) (next-frame))) (defun next-multiframe-window () "Select the next window, regardless of which frame it is on." ------------------------------------------------------------ revno: 113714 committer: Juanma Barranquero branch nick: trunk timestamp: Tue 2013-08-06 11:38:41 +0200 message: lisp/vc/vc.el: Silence byte-compiler warning. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-06 01:26:29 +0000 +++ lisp/ChangeLog 2013-08-06 09:38:41 +0000 @@ -1,5 +1,8 @@ 2013-08-06 Juanma Barranquero + * vc/vc.el (vc-default-ignore-completion-table): + Silence byte-compiler warning. + * frameset.el (frameset-p): Don't check non-nullness of the `properties' slot , which can indeed be nil. (frameset-live-filter-alist, frameset-persistent-filter-alist): === modified file 'lisp/vc/vc.el' --- lisp/vc/vc.el 2013-08-04 02:55:45 +0000 +++ lisp/vc/vc.el 2013-08-06 09:38:41 +0000 @@ -486,7 +486,7 @@ ;; default implementation always returns nil. ;; ;; - root (file) -;; +;; ;; Return the root of the VC controlled hierarchy for file. ;; ;; - repository-hostname (dirname) @@ -502,13 +502,13 @@ ;; Ignore FILE under the current VCS. When called interactively and ;; with a prefix argument, remove an ignored file. When called from ;; Lisp code, if REMOVE is non-nil, remove FILE from ignored files." -;; +;; ;; - ignore-completion-table -;; +;; ;; Return the completion table for files ignored by the current ;; version control system, e.g., the entries in `.gitignore' and ;; `.bzrignore'. -;; +;; ;; - previous-revision (file rev) ;; ;; Return the revision number that precedes REV for FILE, or nil if no such @@ -1365,7 +1365,7 @@ (setq backend (vc-backend directory)) (vc-call-backend backend 'ignore file default-directory remove)))) -(defun vc-default-ignore-completion-table (file) +(defun vc-default-ignore-completion-table (_file) "Return the list of ignored files." ;; Unused lexical argument `file' nil) ------------------------------------------------------------ revno: 113713 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2013-08-06 10:53:09 +0400 message: Use region cache to speedup bidi_find_paragraph_start. * src/buffer.h (struct buffer): New member bidi_paragraph_cache. Rename cache_long_line_scans to cache_long_scans. * src/buffer.c (bset_cache_long_line_scans): Rename to bset_cache_long_scans. (Fget_buffer_create, Fmake_indirect_buffer, Fkill_buffer) (Fbuffer_swap_text, init_buffer_once): Take bidi_paragraph_cache into account. (syms_of_buffer): Rename cache-long-line-scans to cache-long-scans. Adjust docstring. * src/search.c (newline_cache_on_off): * src/indent.c (width_run_cache_on_off): Adjust users. * src/bidi.c (bidi_paragraph_cache_on_off): New function. (bidi_find_paragraph_start): Use bidi_paragraph_cache if needed. * src/insdel.c (prepare_to_modify_buffer): Invalidate bidi_paragraph_cache if enabled. * doc/lispref/positions.texi (Motion by Screen Lines): * doc/lispref/display.texi (Truncation): Rename `cache-long-line-scans' to `cache-long-scans'. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-08-05 11:37:47 +0000 +++ doc/lispref/ChangeLog 2013-08-06 06:53:09 +0000 @@ -1,3 +1,9 @@ +2013-08-06 Dmitry Antipov + + * positions.texi (Motion by Screen Lines): + * display.texi (Truncation): Rename `cache-long-line-scans' + to `cache-long-scans'. + 2013-08-05 Xue Fuqiao * windows.texi (Window Start and End): Add an index. === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2013-08-02 13:52:10 +0000 +++ doc/lispref/display.texi 2013-08-06 06:53:09 +0000 @@ -217,9 +217,9 @@ continuation to display them, computing the continuation lines can make redisplay slow. The column computation and indentation functions also become slow. Then you might find it advisable to set -@code{cache-long-line-scans} to @code{t}. +@code{cache-long-scans} to @code{t}. -@defvar cache-long-line-scans +@defvar cache-long-scans If this variable is non-@code{nil}, various indentation and motion functions, and Emacs redisplay, cache the results of scanning the buffer, and consult the cache to avoid rescanning regions of the buffer === modified file 'doc/lispref/positions.texi' --- doc/lispref/positions.texi 2013-01-01 09:11:05 +0000 +++ doc/lispref/positions.texi 2013-08-06 06:53:09 +0000 @@ -483,7 +483,7 @@ These functions scan text to determine where screen lines break, and thus take time proportional to the distance scanned. If you intend to use them heavily, Emacs provides caches which may improve the -performance of your code. @xref{Truncation, cache-long-line-scans}. +performance of your code. @xref{Truncation, cache-long-scans}. @defun vertical-motion count &optional window This function moves point to the start of the screen line @var{count} === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-06 05:30:18 +0000 +++ src/ChangeLog 2013-08-06 06:53:09 +0000 @@ -1,5 +1,24 @@ 2013-08-06 Dmitry Antipov + Use region cache to speedup bidi_find_paragraph_start. + * buffer.h (struct buffer): New member bidi_paragraph_cache. + Rename cache_long_line_scans to cache_long_scans. + * buffer.c (bset_cache_long_line_scans): Rename to + bset_cache_long_scans. + (Fget_buffer_create, Fmake_indirect_buffer, Fkill_buffer) + (Fbuffer_swap_text, init_buffer_once): Take bidi_paragraph_cache + into account. + (syms_of_buffer): Rename cache-long-line-scans to + cache-long-scans. Adjust docstring. + * search.c (newline_cache_on_off): + * indent.c (width_run_cache_on_off): Adjust users. + * bidi.c (bidi_paragraph_cache_on_off): New function. + (bidi_find_paragraph_start): Use bidi_paragraph_cache if needed. + * insdel.c (prepare_to_modify_buffer): Invalidate + bidi_paragraph_cache if enabled. + +2013-08-06 Dmitry Antipov + Invalidate region caches only if buffer text is going to be changed. * lisp.h (modify_region_1): Remove 3rd arg and rename to... (modify_text): ...new prototype. === modified file 'src/bidi.c' --- src/bidi.c 2013-06-08 18:28:36 +0000 +++ src/bidi.c 2013-08-06 06:53:09 +0000 @@ -61,6 +61,7 @@ #include "character.h" #include "buffer.h" #include "dispextern.h" +#include "region-cache.h" static bool bidi_initialized = 0; @@ -1085,6 +1086,29 @@ return val; } +/* If the user has requested the long scans caching, make sure that + BIDI cache is enabled. Otherwise, make sure it's disabled. */ + +static struct region_cache * +bidi_paragraph_cache_on_off (void) +{ + if (NILP (BVAR (current_buffer, cache_long_scans))) + { + if (current_buffer->bidi_paragraph_cache) + { + free_region_cache (current_buffer->bidi_paragraph_cache); + current_buffer->bidi_paragraph_cache = 0; + } + return NULL; + } + else + { + if (!current_buffer->bidi_paragraph_cache) + current_buffer->bidi_paragraph_cache = new_region_cache (); + return current_buffer->bidi_paragraph_cache; + } +} + /* On my 2005-vintage machine, searching back for paragraph start takes ~1 ms per line. And bidi_paragraph_init is called 4 times when user types C-p. The number below limits each call to @@ -1100,7 +1124,8 @@ { Lisp_Object re = paragraph_start_re; ptrdiff_t limit = ZV, limit_byte = ZV_BYTE; - ptrdiff_t n = 0; + struct region_cache *bpc = bidi_paragraph_cache_on_off (); + ptrdiff_t n = 0, oldpos = pos, next; while (pos_byte > BEGV_BYTE && n++ < MAX_PARAGRAPH_SEARCH @@ -1111,10 +1136,18 @@ of the text over which we scan back includes paragraph_start_re? */ DEC_BOTH (pos, pos_byte); - pos = find_newline_no_quit (pos, pos_byte, -1, &pos_byte); + if (bpc && region_cache_backward (current_buffer, bpc, pos, &next)) + { + pos = next, pos_byte = CHAR_TO_BYTE (pos); + break; + } + else + pos = find_newline_no_quit (pos, pos_byte, -1, &pos_byte); } if (n >= MAX_PARAGRAPH_SEARCH) - pos_byte = BEGV_BYTE; + pos = BEGV, pos_byte = BEGV_BYTE; + if (bpc) + know_region_cache (current_buffer, bpc, pos, oldpos); return pos_byte; } === modified file 'src/buffer.c' --- src/buffer.c 2013-08-05 04:14:43 +0000 +++ src/buffer.c 2013-08-06 06:53:09 +0000 @@ -203,9 +203,9 @@ b->INTERNAL_FIELD (buffer_file_coding_system) = val; } static void -bset_cache_long_line_scans (struct buffer *b, Lisp_Object val) +bset_cache_long_scans (struct buffer *b, Lisp_Object val) { - b->INTERNAL_FIELD (cache_long_line_scans) = val; + b->INTERNAL_FIELD (cache_long_scans) = val; } static void bset_case_fold_search (struct buffer *b, Lisp_Object val) @@ -583,6 +583,7 @@ b->newline_cache = 0; b->width_run_cache = 0; + b->bidi_paragraph_cache = 0; bset_width_table (b, Qnil); b->prevent_redisplay_optimizations_p = 1; @@ -806,6 +807,7 @@ b->newline_cache = 0; b->width_run_cache = 0; + b->bidi_paragraph_cache = 0; bset_width_table (b, Qnil); name = Fcopy_sequence (name); @@ -1945,6 +1947,11 @@ free_region_cache (b->width_run_cache); b->width_run_cache = 0; } + if (b->bidi_paragraph_cache) + { + free_region_cache (b->bidi_paragraph_cache); + b->bidi_paragraph_cache = 0; + } bset_width_table (b, Qnil); unblock_input (); bset_undo_list (b, Qnil); @@ -2355,6 +2362,7 @@ current_buffer->clip_changed = 1; other_buffer->clip_changed = 1; swapfield (newline_cache, struct region_cache *); swapfield (width_run_cache, struct region_cache *); + swapfield (bidi_paragraph_cache, struct region_cache *); current_buffer->prevent_redisplay_optimizations_p = 1; other_buffer->prevent_redisplay_optimizations_p = 1; swapfield (overlays_before, struct Lisp_Overlay *); @@ -5169,7 +5177,7 @@ bset_buffer_file_coding_system (&buffer_defaults, Qnil); XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); - bset_cache_long_line_scans (&buffer_defaults, Qnil); + bset_cache_long_scans (&buffer_defaults, Qnil); bset_file_truename (&buffer_defaults, Qnil); XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); @@ -5233,7 +5241,7 @@ XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; - XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, cache_long_scans), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; @@ -6120,8 +6128,8 @@ DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil, doc: /* Non-nil means the mark and region are currently active in this buffer. */); - DEFVAR_PER_BUFFER ("cache-long-line-scans", &BVAR (current_buffer, cache_long_line_scans), Qnil, - doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. + DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR (current_buffer, cache_long_scans), Qnil, + doc: /* Non-nil means that Emacs should use caches in attempt to speedup buffer scans. Normally, the line-motion functions work by scanning the buffer for newlines. Columnar operations (like `move-to-column' and @@ -6131,18 +6139,24 @@ motion functions will take longer to execute. Emacs may also take longer to update the display. -If `cache-long-line-scans' is non-nil, these motion functions cache the +If `cache-long-scans' is non-nil, these motion functions cache the results of their scans, and consult the cache to avoid rescanning regions of the buffer until the text is modified. The caches are most beneficial when they prevent the most searching---that is, when the buffer contains long lines and large regions of characters with the same, fixed screen width. -When `cache-long-line-scans' is non-nil, processing short lines will +When `cache-long-scans' is non-nil, processing short lines will become slightly slower (because of the overhead of consulting the cache), and the caches will use memory roughly proportional to the number of newlines and characters whose screen width varies. +Bidirectional editing also requires buffer scans to find paragraph +separators. If you have large paragraphs or no paragraph separators +at all, these scans may be slow. If `cache-long-scans' is non-nil, +results of these scans are cached. This doesn't help too much if +paragraphs are of the reasonable (few thousands of characters) size. + The caches require no explicit maintenance; their accuracy is maintained internally by the Emacs primitives. Enabling or disabling the cache should not affect the behavior of any of the motion === modified file 'src/buffer.h' --- src/buffer.h 2013-08-05 04:14:43 +0000 +++ src/buffer.h 2013-08-06 06:53:09 +0000 @@ -632,9 +632,9 @@ /* List of symbols naming the file format used for auto-save file. */ Lisp_Object INTERNAL_FIELD (auto_save_file_format); - /* True if the newline position cache and width run cache are - enabled. See search.c and indent.c. */ - Lisp_Object INTERNAL_FIELD (cache_long_line_scans); + /* True if the newline position cache, width run cache and BIDI paragraph + cache are enabled. See search.c, indent.c and bidi.c for details. */ + Lisp_Object INTERNAL_FIELD (cache_long_scans); /* If the width run cache is enabled, this table contains the character widths width_run_cache (see above) assumes. When we @@ -839,9 +839,12 @@ the character's width; if it maps a character to zero, we don't know what its width is. This allows compute_motion to process such regions very quickly, using algebra instead of inspecting - each character. See also width_table, below. */ + each character. See also width_table, below. + + The latter cache is used to speedup bidi_find_paragraph_start. */ struct region_cache *newline_cache; struct region_cache *width_run_cache; + struct region_cache *bidi_paragraph_cache; /* Non-zero means don't use redisplay optimizations for displaying this buffer. */ === modified file 'src/indent.c' --- src/indent.c 2013-04-13 08:54:02 +0000 +++ src/indent.c 2013-08-06 06:53:09 +0000 @@ -141,13 +141,13 @@ XSETFASTINT (widthtab->contents[i], character_width (i, disptab)); } -/* Allocate or free the width run cache, as requested by the current - state of current_buffer's cache_long_line_scans variable. */ +/* Allocate or free the width run cache, as requested by the + current state of current_buffer's cache_long_scans variable. */ static void width_run_cache_on_off (void) { - if (NILP (BVAR (current_buffer, cache_long_line_scans)) + if (NILP (BVAR (current_buffer, cache_long_scans)) /* And, for the moment, this feature doesn't work on multibyte characters. */ || !NILP (BVAR (current_buffer, enable_multibyte_characters))) === modified file 'src/insdel.c' --- src/insdel.c 2013-08-06 05:30:18 +0000 +++ src/insdel.c 2013-08-06 06:53:09 +0000 @@ -1879,6 +1879,10 @@ invalidate_region_cache (current_buffer, current_buffer->width_run_cache, start - BEG, Z - end); + if (current_buffer->bidi_paragraph_cache) + invalidate_region_cache (current_buffer, + current_buffer->bidi_paragraph_cache, + start - BEG, Z - end); } /* These macros work with an argument named `preserve_ptr' === modified file 'src/search.c' --- src/search.c 2013-07-16 21:35:45 +0000 +++ src/search.c 2013-08-06 06:53:09 +0000 @@ -598,14 +598,14 @@ /* The newline cache: remembering which sections of text have no newlines. */ -/* If the user has requested newline caching, make sure it's on. +/* If the user has requested the long scans caching, make sure it's on. Otherwise, make sure it's off. This is our cheezy way of associating an action with the change of state of a buffer-local variable. */ static void newline_cache_on_off (struct buffer *buf) { - if (NILP (BVAR (buf, cache_long_line_scans))) + if (NILP (BVAR (buf, cache_long_scans))) { /* It should be off. */ if (buf->newline_cache) ------------------------------------------------------------ revno: 113712 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2013-08-06 09:30:18 +0400 message: Invalidate region caches only if buffer text is going to be changed. * lisp.h (modify_region_1): Remove 3rd arg and rename to... (modify_text): ...new prototype. (prepare_to_modify_buffer_1): New prototype. * textprop.c (modify_region): Rename to... (modify_text_properties): ...new function. (add_text_properties_1, set_text_properties, Fremove_text_properties) (Fremove_list_of_text_properties): Adjust users. * insdel.c (modify_region_1): Remove 3rd arg and reimplement as... (modify_text): ...new function. (prepare_to_modify_buffer): Reimplement mostly as a wrapper for... (prepare_to_modify_buffer_1): ...new function. * casefiddle.c (casify_region): * editfns.c (Fsubst_char_in_region, Ftranslate_region_internal) (Ftranspose_regions): Use modify_text. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-05 18:05:46 +0000 +++ src/ChangeLog 2013-08-06 05:30:18 +0000 @@ -1,3 +1,21 @@ +2013-08-06 Dmitry Antipov + + Invalidate region caches only if buffer text is going to be changed. + * lisp.h (modify_region_1): Remove 3rd arg and rename to... + (modify_text): ...new prototype. + (prepare_to_modify_buffer_1): New prototype. + * textprop.c (modify_region): Rename to... + (modify_text_properties): ...new function. + (add_text_properties_1, set_text_properties, Fremove_text_properties) + (Fremove_list_of_text_properties): Adjust users. + * insdel.c (modify_region_1): Remove 3rd arg and reimplement as... + (modify_text): ...new function. + (prepare_to_modify_buffer): Reimplement mostly as a wrapper for... + (prepare_to_modify_buffer_1): ...new function. + * casefiddle.c (casify_region): + * editfns.c (Fsubst_char_in_region, Ftranslate_region_internal) + (Ftranspose_regions): Use modify_text. + 2013-08-05 Stefan Monnier * lisp.mk (lisp): Add nadvice.elc. === modified file 'src/casefiddle.c' --- src/casefiddle.c 2013-01-02 16:13:04 +0000 +++ src/casefiddle.c 2013-08-06 05:30:18 +0000 @@ -214,7 +214,7 @@ validate_region (&b, &e); start = XFASTINT (b); end = XFASTINT (e); - modify_region_1 (start, end, false); + modify_text (start, end); record_change (start, end - start); start_byte = CHAR_TO_BYTE (start); === modified file 'src/editfns.c' --- src/editfns.c 2013-07-19 01:24:35 +0000 +++ src/editfns.c 2013-08-06 05:30:18 +0000 @@ -2928,7 +2928,7 @@ else if (!changed) { changed = -1; - modify_region_1 (pos, XINT (end), false); + modify_text (pos, XINT (end)); if (! NILP (noundo)) { @@ -3104,7 +3104,7 @@ pos = XINT (start); pos_byte = CHAR_TO_BYTE (pos); end_pos = XINT (end); - modify_region_1 (pos, end_pos, false); + modify_text (pos, end_pos); cnt = 0; for (; pos < end_pos; ) @@ -4615,7 +4615,7 @@ if (end1 == start2) /* adjacent regions */ { - modify_region_1 (start1, end2, false); + modify_text (start1, end2); record_change (start1, len1 + len2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); @@ -4674,8 +4674,8 @@ { USE_SAFE_ALLOCA; - modify_region_1 (start1, end1, false); - modify_region_1 (start2, end2, false); + modify_text (start1, end1); + modify_text (start2, end2); record_change (start1, len1); record_change (start2, len2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); @@ -4708,7 +4708,7 @@ { USE_SAFE_ALLOCA; - modify_region_1 (start1, end2, false); + modify_text (start1, end2); record_change (start1, (end2 - start1)); tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); @@ -4741,7 +4741,7 @@ USE_SAFE_ALLOCA; record_change (start1, (end2 - start1)); - modify_region_1 (start1, end2, false); + modify_text (start1, end2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); === modified file 'src/insdel.c' --- src/insdel.c 2013-08-02 08:32:32 +0000 +++ src/insdel.c 2013-08-06 05:30:18 +0000 @@ -1756,27 +1756,22 @@ return deletion; } -/* Call this if you're about to change the region of current buffer +/* Call this if you're about to change the text of current buffer from character positions START to END. This checks the read-only properties of the region, calls the necessary modification hooks, and warns the next redisplay that it should pay attention to that - area. - - If PRESERVE_CHARS_MODIFF, do not update CHARS_MODIFF. - Otherwise set CHARS_MODIFF to the new value of MODIFF. */ + area. */ void -modify_region_1 (ptrdiff_t start, ptrdiff_t end, bool preserve_chars_modiff) +modify_text (ptrdiff_t start, ptrdiff_t end) { prepare_to_modify_buffer (start, end, NULL); BUF_COMPUTE_UNCHANGED (current_buffer, start - 1, end); - if (MODIFF <= SAVE_MODIFF) record_first_change (); MODIFF++; - if (! preserve_chars_modiff) - CHARS_MODIFF = MODIFF; + CHARS_MODIFF = MODIFF; bset_point_before_scroll (current_buffer, Qnil); } @@ -1792,8 +1787,8 @@ by holding its value temporarily in a marker. */ void -prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end, - ptrdiff_t *preserve_ptr) +prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, + ptrdiff_t *preserve_ptr) { struct buffer *base_buffer; @@ -1864,6 +1859,17 @@ } signal_before_change (start, end, preserve_ptr); + Vdeactivate_mark = Qt; +} + +/* Like above, but called when we know that the buffer text + will be modified and region caches should be invalidated. */ + +void +prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end, + ptrdiff_t *preserve_ptr) +{ + prepare_to_modify_buffer_1 (start, end, preserve_ptr); if (current_buffer->newline_cache) invalidate_region_cache (current_buffer, @@ -1873,10 +1879,8 @@ invalidate_region_cache (current_buffer, current_buffer->width_run_cache, start - BEG, Z - end); +} - Vdeactivate_mark = Qt; -} - /* These macros work with an argument named `preserve_ptr' and a local variable named `preserve_marker'. */ === modified file 'src/lisp.h' --- src/lisp.h 2013-08-05 04:14:43 +0000 +++ src/lisp.h 2013-08-06 05:30:18 +0000 @@ -3370,8 +3370,9 @@ extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, bool); extern Lisp_Object del_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, bool); -extern void modify_region_1 (ptrdiff_t, ptrdiff_t, bool); +extern void modify_text (ptrdiff_t, ptrdiff_t); extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *); +extern void prepare_to_modify_buffer_1 (ptrdiff_t, ptrdiff_t, ptrdiff_t *); extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t); extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); === modified file 'src/textprop.c' --- src/textprop.c 2013-07-16 06:39:49 +0000 +++ src/textprop.c 2013-08-06 05:30:18 +0000 @@ -93,15 +93,25 @@ xsignal0 (Qtext_read_only); } -/* Prepare to modify the region of BUFFER from START to END. */ +/* Prepare to modify the text properties of BUFFER from START to END. */ static void -modify_region (Lisp_Object buffer, Lisp_Object start, Lisp_Object end) +modify_text_properties (Lisp_Object buffer, Lisp_Object start, Lisp_Object end) { + ptrdiff_t b = XINT (start), e = XINT (end); struct buffer *buf = XBUFFER (buffer), *old = current_buffer; set_buffer_internal (buf); - modify_region_1 (XINT (start), XINT (end), true); + + prepare_to_modify_buffer_1 (b, e, NULL); + + BUF_COMPUTE_UNCHANGED (buf, b - 1, e); + if (MODIFF <= SAVE_MODIFF) + record_first_change (); + MODIFF++; + + bset_point_before_scroll (current_buffer, Qnil); + set_buffer_internal (old); } @@ -1213,9 +1223,9 @@ ptrdiff_t prev_total_length = TOTAL_LENGTH (i); ptrdiff_t prev_pos = i->position; - modify_region (object, start, end); + modify_text_properties (object, start, end); /* If someone called us recursively as a side effect of - modify_region, and changed the intervals behind our back + modify_text_properties, and changed the intervals behind our back (could happen if lock_file, called by prepare_to_modify_buffer, triggers redisplay, and that calls add-text-properties again in the same buffer), we cannot continue with I, because its @@ -1357,7 +1367,8 @@ otherwise. */ Lisp_Object -set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object, Lisp_Object coherent_change_p) +set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, + Lisp_Object object, Lisp_Object coherent_change_p) { register INTERVAL i; Lisp_Object ostart, oend; @@ -1403,7 +1414,7 @@ } if (BUFFERP (object) && !NILP (coherent_change_p)) - modify_region (object, start, end); + modify_text_properties (object, start, end); set_text_properties_1 (start, end, properties, object, i); @@ -1558,9 +1569,9 @@ ptrdiff_t prev_total_length = TOTAL_LENGTH (i); ptrdiff_t prev_pos = i->position; - modify_region (object, start, end); + modify_text_properties (object, start, end); /* If someone called us recursively as a side effect of - modify_region, and changed the intervals behind our back + modify_text_properties, and changed the intervals behind our back (could happen if lock_file, called by prepare_to_modify_buffer, triggers redisplay, and that calls add-text-properties again in the same buffer), we cannot continue with I, because its @@ -1667,9 +1678,9 @@ /* We are at the beginning of an interval, with len to scan. The flag `modified' records if changes have been made. - When object is a buffer, we must call modify_region before changes are - made and signal_after_change when we are done. - We call modify_region before calling remove_properties if modified == 0, + When object is a buffer, we must call modify_text_properties + before changes are made and signal_after_change when we are done. + We call modify_text_properties before calling remove_properties if modified == 0, and we call signal_after_change before returning if modified != 0. */ for (;;) { @@ -1693,7 +1704,7 @@ else if (LENGTH (i) == len) { if (!modified && BUFFERP (object)) - modify_region (object, start, end); + modify_text_properties (object, start, end); remove_properties (Qnil, properties, i, object); if (BUFFERP (object)) signal_after_change (XINT (start), XINT (end) - XINT (start), @@ -1706,7 +1717,7 @@ i = split_interval_left (i, len); copy_properties (unchanged, i); if (!modified && BUFFERP (object)) - modify_region (object, start, end); + modify_text_properties (object, start, end); remove_properties (Qnil, properties, i, object); if (BUFFERP (object)) signal_after_change (XINT (start), XINT (end) - XINT (start), @@ -1717,7 +1728,7 @@ if (interval_has_some_properties_list (properties, i)) { if (!modified && BUFFERP (object)) - modify_region (object, start, end); + modify_text_properties (object, start, end); remove_properties (Qnil, properties, i, object); modified = 1; }