Now on revision 111882. ------------------------------------------------------------ revno: 111882 committer: Paul Eggert branch nick: trunk timestamp: Mon 2013-02-25 19:09:08 -0800 message: Minor textprop integer cleanup. * intervals.h, textprop.c (add_text_properties_from_list): Return void, not int, since nobody uses the return value. * textprop.c (validate_plist, add_properties, remove_properties) (Fadd_text_properties): Don't assume list length fits in int. (interval_has_all_properties, interval_has_some_properties) (interval_has_some_properties_list, add_properties, remove_properties) (Fadd_text_properties, Fremove_text_properties) (Fremove_list_of_text_properties, text_property_stickiness): Use bool for booleans. (Fadd_text_properties, Fremove_text_properties): (Fremove_list_of_text_properties): Reindent do-while as per GNU style. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-25 17:36:03 +0000 +++ src/ChangeLog 2013-02-26 03:09:08 +0000 @@ -1,3 +1,20 @@ +2013-02-26 Paul Eggert + + Minor textprop integer cleanup. + * intervals.h, textprop.c (add_text_properties_from_list): + Return void, not int, since nobody uses the return value. + * textprop.c (validate_plist, add_properties, remove_properties) + (Fadd_text_properties): + Don't assume list length fits in int. + (interval_has_all_properties, interval_has_some_properties) + (interval_has_some_properties_list, add_properties, remove_properties) + (Fadd_text_properties, Fremove_text_properties) + (Fremove_list_of_text_properties, text_property_stickiness): + Use bool for booleans. + (Fadd_text_properties, Fremove_text_properties): + (Fremove_list_of_text_properties): + Reindent do-while as per GNU style. + 2013-02-25 Eli Zaretskii Implement CLASH_DETECTION for MS-Windows. === modified file 'src/intervals.h' --- src/intervals.h 2013-01-01 09:11:05 +0000 +++ src/intervals.h 2013-02-26 03:09:08 +0000 @@ -293,7 +293,7 @@ Lisp_Object text_property_list (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); -int add_text_properties_from_list (Lisp_Object, Lisp_Object, Lisp_Object); +void add_text_properties_from_list (Lisp_Object, Lisp_Object, Lisp_Object); Lisp_Object extend_property_ranges (Lisp_Object, Lisp_Object); Lisp_Object get_char_property_and_overlay (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object*); === modified file 'src/textprop.c' --- src/textprop.c 2013-02-25 16:13:42 +0000 +++ src/textprop.c 2013-02-26 03:09:08 +0000 @@ -198,14 +198,14 @@ if (CONSP (list)) { - register int i; - register Lisp_Object tail; - for (i = 0, tail = list; CONSP (tail); i++) + bool odd_length = 0; + Lisp_Object tail; + for (tail = list; CONSP (tail); tail = XCDR (tail)) { - tail = XCDR (tail); + odd_length ^= 1; QUIT; } - if (i & 1) + if (odd_length) error ("Odd length text property list"); return list; } @@ -213,20 +213,19 @@ return Fcons (list, Fcons (Qnil, Qnil)); } -/* Return nonzero if interval I has all the properties, +/* Return true if interval I has all the properties, with the same values, of list PLIST. */ -static int +static bool interval_has_all_properties (Lisp_Object plist, INTERVAL i) { - register Lisp_Object tail1, tail2, sym1; - register int found; + Lisp_Object tail1, tail2; /* Go through each element of PLIST. */ for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) { - sym1 = XCAR (tail1); - found = 0; + Lisp_Object sym1 = XCAR (tail1); + bool found = 0; /* Go through I's plist, looking for sym1 */ for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2))) @@ -249,13 +248,13 @@ return 1; } -/* Return nonzero if the plist of interval I has any of the +/* Return true if the plist of interval I has any of the properties of PLIST, regardless of their values. */ -static int +static bool interval_has_some_properties (Lisp_Object plist, INTERVAL i) { - register Lisp_Object tail1, tail2, sym; + Lisp_Object tail1, tail2, sym; /* Go through each element of PLIST. */ for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) @@ -274,10 +273,10 @@ /* Return nonzero if the plist of interval I has any of the property names in LIST, regardless of their values. */ -static int +static bool interval_has_some_properties_list (Lisp_Object list, INTERVAL i) { - register Lisp_Object tail1, tail2, sym; + Lisp_Object tail1, tail2, sym; /* Go through each element of LIST. */ for (tail1 = list; CONSP (tail1); tail1 = XCDR (tail1)) @@ -358,15 +357,14 @@ OBJECT should be the string or buffer the interval is in. - Return nonzero if this changes I (i.e., if any members of PLIST + Return true if this changes I (i.e., if any members of PLIST are actually added to I's plist) */ -static int +static bool add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object) { Lisp_Object tail1, tail2, sym1, val1; - register int changed = 0; - register int found; + bool changed = 0; struct gcpro gcpro1, gcpro2, gcpro3; tail1 = plist; @@ -380,9 +378,9 @@ /* Go through each element of PLIST. */ for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) { + bool found = 0; sym1 = XCAR (tail1); val1 = Fcar (XCDR (tail1)); - found = 0; /* Go through I's plist, looking for sym1 */ for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2))) @@ -410,7 +408,7 @@ /* I's property has a different value -- change it */ Fsetcar (this_cdr, val1); - changed++; + changed = 1; break; } @@ -423,7 +421,7 @@ sym1, Qnil, object); } set_interval_plist (i, Fcons (sym1, Fcons (val1, i->plist))); - changed++; + changed = 1; } } @@ -437,14 +435,14 @@ (If PLIST is non-nil, use that, otherwise use LIST.) OBJECT is the string or buffer containing I. */ -static int +static bool remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object object) { - register Lisp_Object tail1, tail2, sym, current_plist; - register int changed = 0; + Lisp_Object tail1, tail2, sym, current_plist; + bool changed = 0; - /* Nonzero means tail1 is a plist, otherwise it is a list. */ - int use_plist; + /* True means tail1 is a plist, otherwise it is a list. */ + bool use_plist; current_plist = i->plist; @@ -467,7 +465,7 @@ object); current_plist = XCDR (XCDR (current_plist)); - changed++; + changed = 1; } /* Go through I's plist, looking for SYM. */ @@ -483,7 +481,7 @@ sym, XCAR (XCDR (this)), object); Fsetcdr (XCDR (tail2), XCDR (XCDR (this))); - changed++; + changed = 1; } tail2 = this; } @@ -1129,11 +1127,10 @@ Return t if any property value actually changed, nil otherwise. */) (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) { - register INTERVAL i, unchanged; - register ptrdiff_t s, len; - register int modified = 0; + INTERVAL i, unchanged; + ptrdiff_t s, len; + bool modified = 0; struct gcpro gcpro1; - ptrdiff_t got; properties = validate_plist (properties); if (NILP (properties)) @@ -1156,14 +1153,17 @@ /* If this interval already has the properties, we can skip it. */ if (interval_has_all_properties (properties, i)) { - got = LENGTH (i) - (s - i->position); - do { - if (got >= len) - RETURN_UNGCPRO (Qnil); - len -= got; - i = next_interval (i); - got = LENGTH (i); - } while (interval_has_all_properties (properties, i)); + ptrdiff_t got = LENGTH (i) - (s - i->position); + + do + { + if (got >= len) + RETURN_UNGCPRO (Qnil); + len -= got; + i = next_interval (i); + got = LENGTH (i); + } + while (interval_has_all_properties (properties, i)); } else if (i->position != s) { @@ -1220,7 +1220,7 @@ } len -= LENGTH (i); - modified += add_properties (properties, i, object); + modified |= add_properties (properties, i, object); i = next_interval (i); } } @@ -1424,10 +1424,9 @@ Use `set-text-properties' if you want to remove all text properties. */) (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) { - register INTERVAL i, unchanged; - register ptrdiff_t s, len; - register int modified = 0; - ptrdiff_t got; + INTERVAL i, unchanged; + ptrdiff_t s, len; + bool modified = 0; if (NILP (object)) XSETBUFFER (object, current_buffer); @@ -1442,14 +1441,17 @@ /* If there are no properties on this entire interval, return. */ if (! interval_has_some_properties (properties, i)) { - got = (LENGTH (i) - (s - i->position)); - do { - if (got >= len) - return Qnil; - len -= got; - i = next_interval (i); - got = LENGTH (i); - } while (! interval_has_some_properties (properties, i)); + ptrdiff_t got = LENGTH (i) - (s - i->position); + + do + { + if (got >= len) + return Qnil; + len -= got; + i = next_interval (i); + got = LENGTH (i); + } + while (! interval_has_some_properties (properties, i)); } /* Split away the beginning of this interval; what we don't want to modify. */ @@ -1500,7 +1502,7 @@ } len -= LENGTH (i); - modified += remove_properties (properties, Qnil, i, object); + modified |= remove_properties (properties, Qnil, i, object); i = next_interval (i); } } @@ -1515,11 +1517,10 @@ Return t if any property was actually removed, nil otherwise. */) (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) { - register INTERVAL i, unchanged; - register ptrdiff_t s, len; - register int modified = 0; + INTERVAL i, unchanged; + ptrdiff_t s, len; + bool modified = 0; Lisp_Object properties; - ptrdiff_t got; properties = list_of_properties; if (NILP (object)) @@ -1535,14 +1536,17 @@ /* If there are no properties on the interval, return. */ if (! interval_has_some_properties_list (properties, i)) { - got = (LENGTH (i) - (s - i->position)); - do { - if (got >= len) - return Qnil; - len -= got; - i = next_interval (i); - got = LENGTH (i); - } while (! interval_has_some_properties_list (properties, i)); + ptrdiff_t got = LENGTH (i) - (s - i->position); + + do + { + if (got >= len) + return Qnil; + len -= got; + i = next_interval (i); + got = LENGTH (i); + } + while (! interval_has_some_properties_list (properties, i)); } /* Split away the beginning of this interval; what we don't want to modify. */ @@ -1697,7 +1701,7 @@ text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer) { Lisp_Object prev_pos, front_sticky; - int is_rear_sticky = 1, is_front_sticky = 0; /* defaults */ + bool is_rear_sticky = 1, is_front_sticky = 0; /* defaults */ Lisp_Object defalt = Fassq (prop, Vtext_property_default_nonsticky); if (NILP (buffer)) @@ -1772,7 +1776,7 @@ Lisp_Object stuff; Lisp_Object plist; ptrdiff_t s, e, e2, p, len; - int modified = 0; + bool modified = 0; struct gcpro gcpro1, gcpro2; i = validate_interval_range (src, &start, &end, soft); @@ -1843,7 +1847,7 @@ res = Fadd_text_properties (Fcar (res), Fcar (Fcdr (res)), Fcar (Fcdr (Fcdr (res))), dest); if (! NILP (res)) - modified++; + modified = 1; stuff = Fcdr (stuff); } @@ -1914,33 +1918,28 @@ /* Add text properties to OBJECT from LIST. LIST is a list of triples (START END PLIST), where START and END are positions and PLIST is a property list containing the text properties to add. Adjust START - and END positions by DELTA before adding properties. Value is - non-zero if OBJECT was modified. */ + and END positions by DELTA before adding properties. */ -int +void add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object delta) { struct gcpro gcpro1, gcpro2; - int modified_p = 0; GCPRO2 (list, object); for (; CONSP (list); list = XCDR (list)) { - Lisp_Object item, start, end, plist, tem; + Lisp_Object item, start, end, plist; item = XCAR (list); start = make_number (XINT (XCAR (item)) + XINT (delta)); end = make_number (XINT (XCAR (XCDR (item))) + XINT (delta)); plist = XCAR (XCDR (XCDR (item))); - tem = Fadd_text_properties (start, end, plist, object); - if (!NILP (tem)) - modified_p = 1; + Fadd_text_properties (start, end, plist, object); } UNGCPRO; - return modified_p; } ------------------------------------------------------------ revno: 111881 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-02-25 20:50:45 -0500 message: * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Tweak logic. (easy-mmode-set-keymap-parents): Use make-composed-keymap. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-25 23:27:50 +0000 +++ lisp/ChangeLog 2013-02-26 01:50:45 +0000 @@ -1,3 +1,8 @@ +2013-02-26 Stefan Monnier + + * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Tweak logic. + (easy-mmode-set-keymap-parents): Use make-composed-keymap. + 2013-02-25 Stefan Monnier * emacs-lisp/bytecomp.el (byte-compile-file): Use let. === modified file 'lisp/emacs-lisp/easy-mmode.el' --- lisp/emacs-lisp/easy-mmode.el 2013-02-15 20:01:51 +0000 +++ lisp/emacs-lisp/easy-mmode.el 2013-02-26 01:50:45 +0000 @@ -359,10 +359,8 @@ (MODE-check-buffers (intern (concat global-mode-name "-check-buffers"))) (MODE-cmhh (intern (concat global-mode-name "-cmhh"))) - (MODE-disable-in-buffer - (intern (concat global-mode-name "-disable-in-buffer"))) (minor-MODE-hook (intern (concat mode-name "-hook"))) - (disable-MODE (intern (concat "disable-" mode-name))) + (MODE-set-explicitly (intern (concat mode-name "-set-explicitly"))) (MODE-major-mode (intern (concat (symbol-name mode) "-major-mode"))) keyw) @@ -409,8 +407,6 @@ (add-hook 'find-file-hook ',MODE-check-buffers) (add-hook 'change-major-mode-hook ',MODE-cmhh)) (remove-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers) - (remove-hook 'change-major-mode-after-body-hook - ',MODE-enable-in-buffers) (remove-hook 'find-file-hook ',MODE-check-buffers) (remove-hook 'change-major-mode-hook ',MODE-cmhh)) @@ -425,7 +421,7 @@ ;; A function which checks whether MODE has been disabled in the major ;; mode hook which has just been run. - (add-hook ',minor-MODE-hook ',MODE-disable-in-buffer) + (add-hook ',minor-MODE-hook ',MODE-set-explicitly) ;; List of buffers left to process. (defvar ,MODE-buffers nil) @@ -435,8 +431,7 @@ (dolist (buf ,MODE-buffers) (when (buffer-live-p buf) (with-current-buffer buf - (if ,disable-MODE - (if ,mode (,mode -1)) + (unless ,MODE-set-explicitly (unless (eq ,MODE-major-mode major-mode) (if ,mode (progn @@ -457,30 +452,20 @@ (add-to-list ',MODE-buffers (current-buffer)) (add-hook 'post-command-hook ',MODE-check-buffers)) (put ',MODE-cmhh 'definition-name ',global-mode) - ;; disable-MODE is set in MODE-disable-in-buffer and cleared by + ;; MODE-set-explicitly is set in MODE-set-explicitly and cleared by ;; kill-all-local-variables. - (defvar-local ,disable-MODE nil) - (defun ,MODE-disable-in-buffer () - (unless ,mode - (setq ,disable-MODE t))) - (put ',MODE-disable-in-buffer 'definition-name ',global-mode)))) + (defvar-local ,MODE-set-explicitly nil) + (defun ,MODE-set-explicitly () + (setq ,MODE-set-explicitly t)) + (put ',MODE-set-explicitly 'definition-name ',global-mode)))) ;;; ;;; easy-mmode-defmap ;;; -(eval-and-compile - (if (fboundp 'set-keymap-parents) - (defalias 'easy-mmode-set-keymap-parents 'set-keymap-parents) - (defun easy-mmode-set-keymap-parents (m parents) - (set-keymap-parent - m - (cond - ((not (consp parents)) parents) - ((not (cdr parents)) (car parents)) - (t (let ((m (copy-keymap (pop parents)))) - (easy-mmode-set-keymap-parents m parents) - m))))))) +(defun easy-mmode-set-keymap-parents (m parents) + (set-keymap-parent + m (if (cdr parents) (make-composed-keymap parents) (car parents)))) ;;;###autoload (defun easy-mmode-define-keymap (bs &optional name m args) ------------------------------------------------------------ revno: 111880 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-02-25 18:27:50 -0500 message: * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Use let. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-25 20:57:44 +0000 +++ lisp/ChangeLog 2013-02-25 23:27:50 +0000 @@ -1,3 +1,7 @@ +2013-02-25 Stefan Monnier + + * emacs-lisp/bytecomp.el (byte-compile-file): Use let. + 2013-02-25 Juri Linkov * replace.el (read-regexp): Let-bind `default' to the first @@ -57,8 +61,8 @@ (tramp-default-method): Adapt check for `tramp-ssh-controlmaster-options'. - * net/tramp-sh.el (tramp-methods): Replace - `tramp-ssh-controlmaster-template' by "%c". + * net/tramp-sh.el (tramp-methods): + Replace `tramp-ssh-controlmaster-template' by "%c". (tramp-do-copy-or-rename-file-out-of-band) (tramp-maybe-open-connection): Use it in format spec. Ensure, that it is applied for the first hop only. @@ -80,8 +84,8 @@ * net/tramp.el (tramp-tramp-file-p): Fix docstring. - * net/tramp-sh.el (tramp-sh-handle-insert-directory): Handle - multibyte file names. + * net/tramp-sh.el (tramp-sh-handle-insert-directory): + Handle multibyte file names. 2013-02-22 Glenn Morris @@ -104,8 +108,8 @@ 2013-02-21 Fabián Ezequiel Gallina - * progmodes/python.el (python-info-current-defun): Enhance - match-data cluttering prevention. + * progmodes/python.el (python-info-current-defun): + Enhance match-data cluttering prevention. 2013-02-21 Glenn Morris === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2013-02-25 17:36:03 +0000 +++ lisp/emacs-lisp/bytecomp.el 2013-02-25 23:27:50 +0000 @@ -1781,15 +1781,13 @@ (when byte-compile-verbose (message "Compiling %s..." filename)) (setq byte-compiler-error-flag nil) - (setq byte-compile-level (1+ byte-compile-level)) ;; It is important that input-buffer not be current at this call, ;; so that the value of point set in input-buffer ;; within byte-compile-from-buffer lingers in that buffer. (setq output-buffer (save-current-buffer - (unwind-protect - (byte-compile-from-buffer input-buffer) - (setq byte-compile-level (1- byte-compile-level))))) + (let ((byte-compile-level (1+ byte-compile-level))) + (byte-compile-from-buffer input-buffer)))) (if byte-compiler-error-flag nil (when byte-compile-verbose ------------------------------------------------------------ revno: 111879 author: Adam Sjøgren committer: Katsumi Yamaoka branch nick: trunk timestamp: Mon 2013-02-25 22:47:31 +0000 message: lisp/gnus/mml2015.el (mml2015-epg-key-image): Wrap epg-gpg-program in shell-quote-argument diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-02-22 22:54:37 +0000 +++ lisp/gnus/ChangeLog 2013-02-25 22:47:31 +0000 @@ -1,3 +1,8 @@ +2013-02-25 Adam Sjøgren + + * mml2015-el (mml2015-epg-key-image): Wrap epg-gpg-program in + shell-quote-argument. + 2013-02-22 David Engster * gnus-registry.el (gnus-registry-save): Provide class name when === modified file 'lisp/gnus/mml2015.el' --- lisp/gnus/mml2015.el 2013-02-17 12:46:28 +0000 +++ lisp/gnus/mml2015.el 2013-02-25 22:47:31 +0000 @@ -865,7 +865,7 @@ (coding-system-for-read 'binary) (data (shell-command-to-string (format "%s --list-options no-show-photos --attribute-fd 3 --list-keys %s 3>&1 >/dev/null 2>&1" - epg-gpg-program key-id)))) + (shell-quote-argument epg-gpg-program) key-id)))) (when (> (length data) 0) (insert (substring data 16)) (create-image (buffer-string) nil t))))) ------------------------------------------------------------ revno: 111878 fixes bug: http://debbugs.gnu.org/13805 committer: Juri Linkov branch nick: trunk timestamp: Mon 2013-02-25 22:57:44 +0200 message: * lisp/replace.el (read-regexp): Let-bind `default' to the first element of `defaults' if it's a list, otherwise it should be a string or nil. Let-bind `suggestions' to `defaults' if it's a list, otherwise make a list with the string value. Doc fix. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-25 17:36:03 +0000 +++ lisp/ChangeLog 2013-02-25 20:57:44 +0000 @@ -1,3 +1,11 @@ +2013-02-25 Juri Linkov + + * replace.el (read-regexp): Let-bind `default' to the first + element of `defaults' if it's a list, otherwise it should be + a string or nil. Let-bind `suggestions' to `defaults' if it's + a list, otherwise make a list with the string value. Doc fix. + (Bug#13805) + 2013-02-25 Eli Zaretskii * emacs-lisp/bytecomp.el (byte-recompile-directory): Reject files === modified file 'lisp/replace.el' --- lisp/replace.el 2013-02-22 17:13:05 +0000 +++ lisp/replace.el 2013-02-25 20:57:44 +0000 @@ -583,34 +583,39 @@ (defun read-regexp (prompt &optional defaults history) "Read and return a regular expression as a string. When PROMPT doesn't end with a colon and space, it adds a final \": \". -If DEFAULTS is non-nil, it displays the first default in the prompt. +If the first element of DEFAULTS is non-nil, it's added to the prompt. -Optional arg DEFAULTS is a string or a list of strings that are -prepended to a list of standard default values, which include the -tag at point, the last isearch regexp, the last isearch string, +Optional arg DEFAULTS has the form (DEFAULT . SUGGESTIONS) +or simply DEFAULT where DEFAULT, if non-nil, should be a string that +is returned as the default value when the user enters empty input. +SUGGESTIONS is a list of strings that can be inserted into +the minibuffer using \\\\[next-history-element]. \ +The values supplied in SUGGESTIONS +are prepended to the list of standard suggestions that include +the tag at point, the last isearch regexp, the last isearch string, and the last replacement regexp. -Non-nil HISTORY is a symbol to use for the history list. +Optional arg HISTORY is a symbol to use for the history list. If HISTORY is nil, `regexp-history' is used." - (let* ((defaults - (append - (if (listp defaults) defaults (list defaults)) - (list - ;; Regexp for tag at point. - (let* ((tagf (or find-tag-default-function - (get major-mode 'find-tag-default-function) - 'find-tag-default)) - (tag (funcall tagf))) - (cond ((not tag) "") - ((eq tagf 'find-tag-default) - (format "\\_<%s\\_>" (regexp-quote tag))) - (t (regexp-quote tag)))) - (car regexp-search-ring) - (regexp-quote (or (car search-ring) "")) - (car (symbol-value - query-replace-from-history-variable))))) - (defaults (delete-dups (delq nil (delete "" defaults)))) - (default (car defaults)) + (let* ((default (if (consp defaults) (car defaults) defaults)) + (suggestions (if (listp defaults) defaults (list defaults))) + (suggestions + (append + suggestions + (list + ;; Regexp for tag at point. + (let* ((tagf (or find-tag-default-function + (get major-mode 'find-tag-default-function) + 'find-tag-default)) + (tag (funcall tagf))) + (cond ((not tag) "") + ((eq tagf 'find-tag-default) + (format "\\_<%s\\_>" (regexp-quote tag))) + (t (regexp-quote tag)))) + (car regexp-search-ring) + (regexp-quote (or (car search-ring) "")) + (car (symbol-value query-replace-from-history-variable))))) + (suggestions (delete-dups (delq nil (delete "" suggestions)))) ;; Do not automatically add default to the history for empty input. (history-add-new-input nil) (input (read-from-minibuffer @@ -621,9 +626,11 @@ (query-replace-descr default))) (t (format "%s: " prompt))) - nil nil nil (or history 'regexp-history) defaults t))) + nil nil nil (or history 'regexp-history) suggestions t))) (if (equal input "") + ;; Return the default value when the user enters empty input. (or default input) + ;; Otherwise, add non-empty input to the history and return input. (prog1 input (add-to-history (or history 'regexp-history) input))))) ------------------------------------------------------------ revno: 111877 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2013-02-25 19:36:03 +0200 message: Implement CLASH_DETECTION for MS-Windows. src/filelock.c [WINDOWSNT]: Include w32.h. (MAKE_LOCK_NAME): Don't use 'lock', it clashes with MS runtime function of that name. Up-case the macro arguments. (IS_LOCK_FILE): New macro. (fill_in_lock_file_name): Use IS_LOCK_FILE instead of S_ISLNK. (create_lock_file): New function, with body extracted from lock_file_1. [WINDOWSNT]: Implement lock files by writing a regular file with the lock information as its contents. (read_lock_data): New function, on Posix platforms just calls emacs_readlinkat. [WINDOWSNT]: Read the lock info from the file. (current_lock_owner): Call read_lock_data instead of calling emacs_readlinkat directly. (lock_file) [WINDOWSNT]: Run the file name through dostounix_filename. src/w32proc.c (sys_kill): Support the case of SIG = 0, in which case just check if the process by that PID exists. src/w32.c (sys_open): Don't reset the _O_CREAT flag if _O_EXCL is also present, as doing so will fail to error out if the file already exists. src/makefile.w32-in ($(BLD)/filelock.$(O)): Depend on src/w32.h. nt/inc/ms-w32.h (BOOT_TIME_FILE): Define. nt/config.nt (CLASH_DETECTION): Define to 1. lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Reject files that match "\`\.#", to avoid compiling lock files, even if they are readable (as they are on MS-Windows). doc/emacs/files.texi (Interlocking): Don't refer to symlinks as the exclusive means of locking files. etc/NEWS: Mention support for lock files on MS-Windows. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-02-22 17:13:05 +0000 +++ doc/emacs/ChangeLog 2013-02-25 17:36:03 +0000 @@ -1,3 +1,8 @@ +2013-02-25 Eli Zaretskii + + * files.texi (Interlocking): Don't refer to symlinks as the + exclusive means of locking files. + 2013-02-22 Glenn Morris * ack.texi (Acknowledgments): === modified file 'doc/emacs/files.texi' --- doc/emacs/files.texi 2013-02-21 06:03:02 +0000 +++ doc/emacs/files.texi 2013-02-25 17:36:03 +0000 @@ -734,10 +734,10 @@ @cindex locking files When you make the first modification in an Emacs buffer that is visiting a file, Emacs records that the file is @dfn{locked} by you. -(It does this by creating a specially-named symbolic link in the same -directory.) Emacs removes the lock when you save the changes. The -idea is that the file is locked whenever an Emacs buffer visiting it -has unsaved changes. +(It does this by creating a specially-named symbolic link or regular +file with special contents in the same directory.) Emacs removes the +lock when you save the changes. The idea is that the file is locked +whenever an Emacs buffer visiting it has unsaved changes. @vindex create-lockfiles You can prevent the creation of lock files by setting the variable @@ -774,14 +774,14 @@ simultaneously under different names. A lock file cannot be written in some circumstances, e.g., if Emacs -lacks the system permissions or the system does not support symbolic -links. In these cases, Emacs can still detect the collision when you -try to save a file, by checking the file's last-modification date. If -the file has changed since the last time Emacs visited or saved it, -that implies that changes have been made in some other way, and will -be lost if Emacs proceeds with saving. Emacs then displays a warning -message and asks for confirmation before saving; answer @kbd{yes} to -save, and @kbd{no} or @kbd{C-g} cancel the save. +lacks the system permissions or cannot create lock files for some +other reason. In these cases, Emacs can still detect the collision +when you try to save a file, by checking the file's last-modification +date. If the file has changed since the last time Emacs visited or +saved it, that implies that changes have been made in some other way, +and will be lost if Emacs proceeds with saving. Emacs then displays a +warning message and asks for confirmation before saving; answer +@kbd{yes} to save, and @kbd{no} or @kbd{C-g} cancel the save. If you are notified that simultaneous editing has already taken place, one way to compare the buffer to its file is the @kbd{M-x === modified file 'etc/NEWS' --- etc/NEWS 2013-02-25 17:01:41 +0000 +++ etc/NEWS 2013-02-25 17:36:03 +0000 @@ -348,6 +348,13 @@ Likewise, `file-name-buffer-file-type-alist' is now obsolete, and modifying it has no effect. +--- +** Lock files now work on MS-Windows. +This allows to avoid losing your edits if the same file is being +edited in another Emacs session or by another user. See the node +"Interlocking" in the Emacs User Manual for the details. To disable +file locking, customize `create-lockfiles' to nil. + ** Improved fullscreen support on Mac OS X. Both native (>= OSX 10.7) and "old style" fullscreen are supported. Customize `ns-use-native-fullscreen' to change style. For >= 10.7 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-25 14:29:41 +0000 +++ lisp/ChangeLog 2013-02-25 17:36:03 +0000 @@ -1,3 +1,9 @@ +2013-02-25 Eli Zaretskii + + * emacs-lisp/bytecomp.el (byte-recompile-directory): Reject files + that match "\`\.#", to avoid compiling lock files, even if they + are readable (as they are on MS-Windows). + 2013-02-25 Stefan Monnier * files.el (basic-save-buffer): Remove redundant directory-creation. === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2013-02-23 21:14:36 +0000 +++ lisp/emacs-lisp/bytecomp.el 2013-02-25 17:36:03 +0000 @@ -1594,7 +1594,9 @@ (setq directories (nconc directories (list source)))) ;; It is an ordinary file. Decide whether to compile it. (if (and (string-match emacs-lisp-file-regexp source) + ;; The next 2 tests avoid compiling lock files (file-readable-p source) + (not (string-match "\\`\\.#" file)) (not (auto-save-file-name-p source)) (not (string-equal dir-locals-file (file-name-nondirectory source)))) === modified file 'nt/ChangeLog' --- nt/ChangeLog 2013-02-16 14:16:07 +0000 +++ nt/ChangeLog 2013-02-25 17:36:03 +0000 @@ -1,3 +1,9 @@ +2013-02-25 Eli Zaretskii + + * inc/ms-w32.h (BOOT_TIME_FILE): Define. + + * config.nt (CLASH_DETECTION): Define to 1. + 2013-02-16 Eli Zaretskii * inc/ms-w32.h (__STDC__): Fiddle with value only for MSVC. === modified file 'nt/config.nt' --- nt/config.nt 2013-02-13 00:52:04 +0000 +++ nt/config.nt 2013-02-25 17:36:03 +0000 @@ -75,7 +75,7 @@ /* Define if you want lock files to be written, so that Emacs can tell instantly when you try to modify a file that someone else has modified in his/her Emacs. */ -#undef CLASH_DETECTION +#define CLASH_DETECTION 1 /* Short copyright string for this version of Emacs. */ #define COPYRIGHT "Copyright (C) 2013 Free Software Foundation, Inc." === modified file 'nt/inc/ms-w32.h' --- nt/inc/ms-w32.h 2013-02-16 14:16:07 +0000 +++ nt/inc/ms-w32.h 2013-02-25 17:36:03 +0000 @@ -70,6 +70,18 @@ #define HAVE___BUILTIN_UNWIND_INIT 1 #endif +/* This isn't perfect, as some systems might have the page file in + another place. Also, I suspect that the time stamp of that file + might also change when Windows enlarges the file due to + insufficient VM. Still, this seems to be the most reliable way; + the alternative (of using GetSystemTimes) won't work on laptops + that hibernate, because the system clock is stopped then. Other + possibility would be to run "net statistics workstation" and parse + the output, but that's gross. So this should do; if the file is + not there, the boot time will be returned as zero, and filelock.c + already handles that. */ +#define BOOT_TIME_FILE "C:/pagefile.sys" + /* ============================================================ */ /* Here, add any special hacks needed to make Emacs work on this === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-25 16:13:42 +0000 +++ src/ChangeLog 2013-02-25 17:36:03 +0000 @@ -1,5 +1,33 @@ 2013-02-25 Eli Zaretskii + Implement CLASH_DETECTION for MS-Windows. + + * filelock.c [WINDOWSNT]: Include w32.h. + (MAKE_LOCK_NAME): Don't use 'lock', it clashes with MS runtime + function of that name. Up-case the macro arguments. + (IS_LOCK_FILE): New macro. + (fill_in_lock_file_name): Use IS_LOCK_FILE instead of S_ISLNK. + (create_lock_file): New function, with body extracted from + lock_file_1. + [WINDOWSNT]: Implement lock files by writing a regular file with + the lock information as its contents. + (read_lock_data): New function, on Posix platforms just calls + emacs_readlinkat. + [WINDOWSNT]: Read the lock info from the file. + (current_lock_owner): Call read_lock_data instead of calling + emacs_readlinkat directly. + (lock_file) [WINDOWSNT]: Run the file name through + dostounix_filename. + + * w32proc.c (sys_kill): Support the case of SIG = 0, in which case + just check if the process by that PID exists. + + * w32.c (sys_open): Don't reset the _O_CREAT flag if _O_EXCL is + also present, as doing so will fail to error out if the file + already exists. + + * makefile.w32-in ($(BLD)/filelock.$(O)): Depend on src/w32.h. + * textprop.c (Fadd_text_properties, Fremove_text_properties) (Fremove_list_of_text_properties): Skip all of the intervals in the region between START and END that already have resp. don't === modified file 'src/filelock.c' --- src/filelock.c 2013-02-24 19:45:17 +0000 +++ src/filelock.c 2013-02-25 17:36:03 +0000 @@ -43,6 +43,9 @@ #include "buffer.h" #include "coding.h" #include "systime.h" +#ifdef WINDOWSNT +#include "w32.h" /* for dostounix_filename */ +#endif #ifdef CLASH_DETECTION @@ -288,13 +291,22 @@ #define FREE_LOCK_INFO(i) do { xfree ((i).user); xfree ((i).host); } while (0) -/* Write the name of the lock file for FN into LFNAME. Length will be - that of FN plus two more for the leading `.#' plus 1 for the - trailing period plus one for the digit after it plus one for the - null. */ -#define MAKE_LOCK_NAME(lock, file) \ - (lock = alloca (SBYTES (file) + 2 + 1 + 1 + 1), \ - fill_in_lock_file_name (lock, (file))) +/* Write the name of the lock file for FNAME into LOCKNAME. Length + will be that of FN plus two more for the leading `.#' plus 1 for + the trailing period plus one for the digit after it plus one for + the null. */ +#define MAKE_LOCK_NAME(LOCKNAME, FNAME) \ + (LOCKNAME = alloca (SBYTES (FNAME) + 2 + 1 + 1 + 1), \ + fill_in_lock_file_name (LOCKNAME, (FNAME))) + +#ifdef WINDOWSNT +/* 256 chars for user, 1024 chars for host, 10 digits for each of 2 int's. */ +#define MAX_LFINFO (256 + 1024 + 10 + 10 + 2) + /* min size: .@PID */ +#define IS_LOCK_FILE(ST) (MAX_LFINFO >= (ST).st_size && (ST).st_size >= 3) +#else +#define IS_LOCK_FILE(ST) S_ISLNK ((ST).st_mode) +#endif static void fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn) @@ -318,7 +330,7 @@ p = lockfile + length + 2; - while (lstat (lockfile, &st) == 0 && !S_ISLNK (st.st_mode)) + while (lstat (lockfile, &st) == 0 && !IS_LOCK_FILE (st)) { if (count > 9) { @@ -329,6 +341,49 @@ } } +static int +create_lock_file (char *lfname, char *lock_info_str, bool force) +{ + int err; + +#ifdef WINDOWSNT + /* Symlinks are supported only by latest versions of Windows, and + creating them is a privileged operation that often triggers UAC + elevation prompts. Therefore, instead of using symlinks, we + create a regular file with the lock info written as its + contents. */ + { + int fd = emacs_open (lfname, O_WRONLY | O_BINARY | O_CREAT | O_EXCL, + S_IREAD | S_IWRITE); + + if (fd < 0 && errno == EEXIST && force) + fd = emacs_open (lfname, O_WRONLY | O_BINARY | O_TRUNC, + S_IREAD | S_IWRITE); + if (fd >= 0) + { + ssize_t lock_info_len = strlen (lock_info_str); + + err = 0; + if (emacs_write (fd, lock_info_str, lock_info_len) != lock_info_len) + err = -1; + if (emacs_close (fd)) + err = -1; + } + else + err = -1; + } +#else + err = symlink (lock_info_str, lfname); + if (errno == EEXIST && force) + { + unlink (lfname); + err = symlink (lock_info_str, lfname); + } +#endif + + return err; +} + /* Lock the lock file named LFNAME. If FORCE, do so even if it is already locked. Return true if successful. */ @@ -355,13 +410,7 @@ esprintf (lock_info_str, boot ? "%s@%s.%"pMd":%"pMd : "%s@%s.%"pMd, user_name, host_name, pid, boot); - - err = symlink (lock_info_str, lfname); - if (errno == EEXIST && force) - { - unlink (lfname); - err = symlink (lock_info_str, lfname); - } + err = create_lock_file (lfname, lock_info_str, force); symlink_errno = errno; SAFE_FREE (); @@ -377,6 +426,32 @@ return (a - b >= -1 && a - b <= 1); } +static Lisp_Object +read_lock_data (char *lfname) +{ +#ifndef WINDOWSNT + return emacs_readlinkat (AT_FDCWD, lfname); +#else + int fd = emacs_open (lfname, O_RDONLY | O_BINARY, S_IREAD); + ssize_t nbytes; + char lfinfo[MAX_LFINFO + 1]; + + if (fd < 0) + return Qnil; + + nbytes = emacs_read (fd, lfinfo, MAX_LFINFO); + emacs_close (fd); + + if (nbytes > 0) + { + lfinfo[nbytes] = '\0'; + return build_string (lfinfo); + } + else + return Qnil; +#endif +} + /* Return 0 if nobody owns the lock file LFNAME or the lock is obsolete, 1 if another process owns it (and set OWNER (if non-null) to info), 2 if the current process owns it, @@ -390,7 +465,7 @@ lock_info_type local_owner; intmax_t n; char *at, *dot, *colon; - Lisp_Object lfinfo_object = emacs_readlinkat (AT_FDCWD, lfname); + Lisp_Object lfinfo_object = read_lock_data (lfname); char *lfinfo; struct gcpro gcpro1; @@ -552,6 +627,12 @@ orig_fn = fn; GCPRO1 (fn); fn = Fexpand_file_name (fn, Qnil); +#ifdef WINDOWSNT + /* Ensure we have only '/' separators, to avoid problems with + looking (inside fill_in_lock_file_name) for backslashes in file + names encoded by some DBCS codepage. */ + dostounix_filename (SSDATA (fn), 1); +#endif encoded_fn = ENCODE_FILE (fn); /* Create the name of the lock-file for file fn */ === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2013-02-25 05:55:37 +0000 +++ src/makefile.w32-in 2013-02-25 17:36:03 +0000 @@ -864,6 +864,7 @@ $(BLD)/filelock.$(O) : \ $(SRC)/filelock.c \ + $(SRC)/w32.h \ $(NT_INC)/pwd.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/sys/stat.h \ === modified file 'src/w32.c' --- src/w32.c 2013-02-22 16:00:14 +0000 +++ src/w32.c 2013-02-25 17:36:03 +0000 @@ -3402,10 +3402,13 @@ sys_open (const char * path, int oflag, int mode) { const char* mpath = map_w32_filename (path, NULL); - /* Try to open file without _O_CREAT, to be able to write to hidden - and system files. Force all file handles to be - non-inheritable. */ - int res = _open (mpath, (oflag & ~_O_CREAT) | _O_NOINHERIT, mode); + int res = -1; + + /* If possible, try to open file without _O_CREAT, to be able to + write to existing hidden and system files. Force all file + handles to be non-inheritable. */ + if ((oflag & (_O_CREAT | _O_EXCL)) != (_O_CREAT | _O_EXCL)) + res = _open (mpath, (oflag & ~_O_CREAT) | _O_NOINHERIT, mode); if (res < 0) res = _open (mpath, oflag | _O_NOINHERIT, mode); if (res >= 0 && res < MAXDESC) === modified file 'src/w32proc.c' --- src/w32proc.c 2013-02-19 03:29:28 +0000 +++ src/w32proc.c 2013-02-25 17:36:03 +0000 @@ -2263,12 +2263,42 @@ pid = -pid; /* Only handle signals that will result in the process dying */ - if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) + if (sig != 0 + && sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) { errno = EINVAL; return -1; } + if (sig == 0) + { + /* It will take _some_ time before PID 4 or less on Windows will + be Emacs... */ + if (pid <= 4) + { + errno = EPERM; + return -1; + } + proc_hand = OpenProcess (PROCESS_QUERY_INFORMATION, 0, pid); + if (proc_hand == NULL) + { + DWORD err = GetLastError (); + + switch (err) + { + case ERROR_ACCESS_DENIED: /* existing process, but access denied */ + errno = EPERM; + return -1; + case ERROR_INVALID_PARAMETER: /* process PID does not exist */ + errno = ESRCH; + return -1; + } + } + else + CloseHandle (proc_hand); + return 0; + } + cp = find_child_pid (pid); if (cp == NULL) { ------------------------------------------------------------ revno: 111876 committer: Paul Eggert branch nick: trunk timestamp: Mon 2013-02-25 09:01:41 -0800 message: * NEWS: Document removal of --with-crt-dir. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2013-02-25 05:55:37 +0000 +++ etc/ChangeLog 2013-02-25 17:01:41 +0000 @@ -1,6 +1,7 @@ 2013-02-25 Paul Eggert Simplify data_start configuration (Bug#13783). + * NEWS: Document removal of --with-crt-dir. * PROBLEMS (LIBS_SYSTEM, LIBS_MACHINE, LIBS_STANDARD): Remove. Remove legacy-systems section, as this stuff is no longer applicable with current linking strategies. === modified file 'etc/NEWS' --- etc/NEWS 2013-02-21 06:55:19 +0000 +++ etc/NEWS 2013-02-25 17:01:41 +0000 @@ -28,6 +28,9 @@ build time, like libacl on GNU/Linux. To prevent this, use the configure option `--without-acl'. +** The configure option --with-crt-dir has been removed. +It is no longer needed, as the crt*.o files are no longer linked specially. + * Startup Changes in Emacs 24.4 ------------------------------------------------------------ revno: 111875 fixes bug: http://debbugs.gnu.org/13743 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2013-02-25 18:13:42 +0200 message: Fix bug #13743 with crashes due to recursive add-text-properties. src/textprop.c (Fadd_text_properties, Fremove_text_properties) (Fremove_list_of_text_properties): Skip all of the intervals in the region between START and END that already have resp. don't have the requested properties, not just the first one. Add assertions that the loop afterwards always modifies the properties. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-25 16:05:49 +0000 +++ src/ChangeLog 2013-02-25 16:13:42 +0000 @@ -1,3 +1,12 @@ +2013-02-25 Eli Zaretskii + + * textprop.c (Fadd_text_properties, Fremove_text_properties) + (Fremove_list_of_text_properties): Skip all of the intervals in + the region between START and END that already have resp. don't + have the requested properties, not just the first one. Add + assertions that the loop afterwards always modifies the + properties. (Bug#13743) + 2013-02-25 Stefan Monnier * callint.c (Fcall_interactively): Use the right lexical environment === modified file 'src/textprop.c' --- src/textprop.c 2013-01-02 16:13:04 +0000 +++ src/textprop.c 2013-02-25 16:13:42 +0000 @@ -1133,6 +1133,7 @@ register ptrdiff_t s, len; register int modified = 0; struct gcpro gcpro1; + ptrdiff_t got; properties = validate_plist (properties); if (NILP (properties)) @@ -1152,26 +1153,25 @@ and live buffers are always protected. */ GCPRO1 (properties); - /* If we're not starting on an interval boundary, we have to - split this interval. */ - if (i->position != s) - { - /* If this interval already has the properties, we can - skip it. */ - if (interval_has_all_properties (properties, i)) - { - ptrdiff_t got = (LENGTH (i) - (s - i->position)); - if (got >= len) - RETURN_UNGCPRO (Qnil); - len -= got; - i = next_interval (i); - } - else - { - unchanged = i; - i = split_interval_right (unchanged, s - unchanged->position); - copy_properties (unchanged, i); - } + /* If this interval already has the properties, we can skip it. */ + if (interval_has_all_properties (properties, i)) + { + got = LENGTH (i) - (s - i->position); + do { + if (got >= len) + RETURN_UNGCPRO (Qnil); + len -= got; + i = next_interval (i); + got = LENGTH (i); + } while (interval_has_all_properties (properties, i)); + } + else if (i->position != s) + { + /* If we're not starting on an interval boundary, we have to + split this interval. */ + unchanged = i; + i = split_interval_right (unchanged, s - unchanged->position); + copy_properties (unchanged, i); } if (BUFFERP (object)) @@ -1195,7 +1195,8 @@ signal_after_change (XINT (start), XINT (end) - XINT (start), XINT (end) - XINT (start)); - return modified ? Qt : Qnil; + eassert (modified); + return Qt; } if (LENGTH (i) == len) @@ -1426,6 +1427,7 @@ register INTERVAL i, unchanged; register ptrdiff_t s, len; register int modified = 0; + ptrdiff_t got; if (NILP (object)) XSETBUFFER (object, current_buffer); @@ -1437,26 +1439,25 @@ s = XINT (start); len = XINT (end) - s; - if (i->position != s) - { - /* No properties on this first interval -- return if - it covers the entire region. */ - if (! interval_has_some_properties (properties, i)) - { - ptrdiff_t got = (LENGTH (i) - (s - i->position)); - if (got >= len) - return Qnil; - len -= got; - i = next_interval (i); - } - /* Split away the beginning of this interval; what we don't - want to modify. */ - else - { - unchanged = i; - i = split_interval_right (unchanged, s - unchanged->position); - copy_properties (unchanged, i); - } + /* If there are no properties on this entire interval, return. */ + if (! interval_has_some_properties (properties, i)) + { + got = (LENGTH (i) - (s - i->position)); + do { + if (got >= len) + return Qnil; + len -= got; + i = next_interval (i); + got = LENGTH (i); + } while (! interval_has_some_properties (properties, i)); + } + /* Split away the beginning of this interval; what we don't + want to modify. */ + else if (i->position != s) + { + unchanged = i; + i = split_interval_right (unchanged, s - unchanged->position); + copy_properties (unchanged, i); } if (BUFFERP (object)) @@ -1470,7 +1471,13 @@ if (LENGTH (i) >= len) { if (! interval_has_some_properties (properties, i)) - return modified ? Qt : Qnil; + { + eassert (modified); + if (BUFFERP (object)) + signal_after_change (XINT (start), XINT (end) - XINT (start), + XINT (end) - XINT (start)); + return Qt; + } if (LENGTH (i) == len) { @@ -1512,6 +1519,7 @@ register ptrdiff_t s, len; register int modified = 0; Lisp_Object properties; + ptrdiff_t got; properties = list_of_properties; if (NILP (object)) @@ -1524,26 +1532,25 @@ s = XINT (start); len = XINT (end) - s; - if (i->position != s) - { - /* No properties on this first interval -- return if - it covers the entire region. */ - if (! interval_has_some_properties_list (properties, i)) - { - ptrdiff_t got = (LENGTH (i) - (s - i->position)); - if (got >= len) - return Qnil; - len -= got; - i = next_interval (i); - } - /* Split away the beginning of this interval; what we don't - want to modify. */ - else - { - unchanged = i; - i = split_interval_right (unchanged, s - unchanged->position); - copy_properties (unchanged, i); - } + /* If there are no properties on the interval, return. */ + if (! interval_has_some_properties_list (properties, i)) + { + got = (LENGTH (i) - (s - i->position)); + do { + if (got >= len) + return Qnil; + len -= got; + i = next_interval (i); + got = LENGTH (i); + } while (! interval_has_some_properties_list (properties, i)); + } + /* Split away the beginning of this interval; what we don't + want to modify. */ + else if (i->position != s) + { + unchanged = i; + i = split_interval_right (unchanged, s - unchanged->position); + copy_properties (unchanged, i); } /* We are at the beginning of an interval, with len to scan. ------------------------------------------------------------ revno: 111874 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13811 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-02-25 11:05:49 -0500 message: * src/callint.c (Fcall_interactively): Use the right lexical environment for `interactive' specs. * src/eval.c (Feval): Accept a lexical environment. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-25 05:55:37 +0000 +++ src/ChangeLog 2013-02-25 16:05:49 +0000 @@ -1,3 +1,9 @@ +2013-02-25 Stefan Monnier + + * callint.c (Fcall_interactively): Use the right lexical environment + for `interactive' specs (bug#13811). + * eval.c (Feval): Accept a lexical environment. + 2013-02-25 Paul Eggert Simplify data_start configuration (Bug#13783). === modified file 'src/callint.c' --- src/callint.c 2013-02-17 16:49:27 +0000 +++ src/callint.c 2013-02-25 16:05:49 +0000 @@ -342,8 +342,8 @@ /* Compute the arg values using the user's expression. */ GCPRO2 (input, filter_specs); specs = Feval (specs, - CONSP (funval) && EQ (Qclosure, XCAR (funval)) - ? Qt : Qnil); + CONSP (funval) && EQ (Qclosure, XCAR (funval)) + ? CAR_SAFE (XCDR (funval)) : Qnil); UNGCPRO; if (events != num_input_events || !NILP (record_flag)) { === modified file 'src/eval.c' --- src/eval.c 2013-02-15 06:35:54 +0000 +++ src/eval.c 2013-02-25 16:05:49 +0000 @@ -1898,7 +1898,7 @@ { ptrdiff_t count = SPECPDL_INDEX (); specbind (Qinternal_interpreter_environment, - NILP (lexical) ? Qnil : Fcons (Qt, Qnil)); + CONSP (lexical) || NILP (lexical) ? lexical : Fcons (Qt, Qnil)); return unbind_to (count, eval_sub (form)); } ------------------------------------------------------------ revno: 111873 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-02-25 09:29:41 -0500 message: * lisp/files.el (basic-save-buffer): Remove redundant directory-creation. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-24 01:05:13 +0000 +++ lisp/ChangeLog 2013-02-25 14:29:41 +0000 @@ -1,3 +1,7 @@ +2013-02-25 Stefan Monnier + + * files.el (basic-save-buffer): Remove redundant directory-creation. + 2013-02-24 Jay Belanger * calc/calc-ext.el (math-to-radians-2, math-from-radians-2): === modified file 'lisp/files.el' --- lisp/files.el 2013-02-21 02:44:06 +0000 +++ lisp/files.el 2013-02-25 14:29:41 +0000 @@ -4563,32 +4563,21 @@ (not (file-exists-p buffer-file-name)))) (let ((recent-save (recent-auto-save-p)) setmodes) - ;; If buffer has no file name, ask user for one. + ;; If buffer has no file name, ask user for one. (or buffer-file-name - (let ((filename - (expand-file-name - (read-file-name "File to save in: " - nil (expand-file-name (buffer-name)))))) - (if (file-exists-p filename) - (if (file-directory-p filename) - ;; Signal an error if the user specified the name of an - ;; existing directory. - (error "%s is a directory" filename) - (unless (y-or-n-p (format "File `%s' exists; overwrite? " - filename)) - (error "Canceled"))) - ;; Signal an error if the specified name refers to a - ;; non-existing directory. - (let ((dir (file-name-directory filename))) - (unless (file-directory-p dir) - (if (file-exists-p dir) - (error "%s is not a directory" dir) - (if (y-or-n-p - (format "Directory `%s' does not exist; create? " - dir)) - (make-directory dir t) - (error "Canceled")))))) - (set-visited-file-name filename))) + (let ((filename + (expand-file-name + (read-file-name "File to save in: " + nil (expand-file-name (buffer-name)))))) + (if (file-exists-p filename) + (if (file-directory-p filename) + ;; Signal an error if the user specified the name of an + ;; existing directory. + (error "%s is a directory" filename) + (unless (y-or-n-p (format "File `%s' exists; overwrite? " + filename)) + (error "Canceled")))) + (set-visited-file-name filename))) (or (verify-visited-file-modtime (current-buffer)) (not (file-exists-p buffer-file-name)) (yes-or-no-p ------------------------------------------------------------ revno: 111872 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-02-25 06:17:36 -0500 message: Auto-commit of generated files. diff: === modified file 'autogen/Makefile.in' --- autogen/Makefile.in 2013-02-12 11:17:35 +0000 +++ autogen/Makefile.in 2013-02-25 11:17:36 +0000 @@ -174,7 +174,6 @@ COM_ERRLIB = @COM_ERRLIB@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CRT_DIR = @CRT_DIR@ CRYPTOLIB = @CRYPTOLIB@ CYGPATH_W = @CYGPATH_W@ CYGWIN_OBJ = @CYGWIN_OBJ@ @@ -619,7 +618,6 @@ KRB4LIB = @KRB4LIB@ KRB5LIB = @KRB5LIB@ LDFLAGS = @LDFLAGS@ -LD_FIRSTFLAG = @LD_FIRSTFLAG@ LD_SWITCH_SYSTEM = @LD_SWITCH_SYSTEM@ LD_SWITCH_SYSTEM_TEMACS = @LD_SWITCH_SYSTEM_TEMACS@ LD_SWITCH_X_SITE = @LD_SWITCH_X_SITE@ @@ -659,11 +657,9 @@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ LIB_EACCESS = @LIB_EACCESS@ LIB_EXECINFO = @LIB_EXECINFO@ -LIB_GCC = @LIB_GCC@ LIB_MATH = @LIB_MATH@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ -LIB_STANDARD = @LIB_STANDARD@ LIB_TIMER_TIME = @LIB_TIMER_TIME@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ @@ -858,7 +854,6 @@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ -START_FILES = @START_FILES@ STDALIGN_H = @STDALIGN_H@ STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ === modified file 'autogen/config.in' --- autogen/config.in 2013-02-12 11:17:35 +0000 +++ autogen/config.in 2013-02-25 11:17:36 +0000 @@ -93,9 +93,6 @@ /* Extra bits to be or'd in with any pointers stored in a Lisp_Object. */ #undef DATA_SEG_BITS -/* Address of the start of the data segment. */ -#undef DATA_START - /* Name of the default sound device. */ #undef DEFAULT_SOUND_DEVICE @@ -259,6 +256,10 @@ /* Define to 1 if you have the `copysign' function. */ #undef HAVE_COPYSIGN +/* Define to 1 if data_start is the address of the start of the main data + segment. */ +#undef HAVE_DATA_START + /* Define to 1 if using D-Bus. */ #undef HAVE_DBUS @@ -1227,9 +1228,6 @@ /* Define to 1 if the nlist n_name member is a pointer */ #undef N_NAME_POINTER -/* Define if the C compiler is the linker. */ -#undef ORDINARY_LINK - /* Name of package */ #undef PACKAGE === modified file 'autogen/configure' --- autogen/configure 2013-02-15 17:31:12 +0000 +++ autogen/configure 2013-02-25 11:17:36 +0000 @@ -605,8 +605,6 @@ LIBOBJS SUBDIR_MAKEFILES_IN WINDOW_SYSTEM_OBJ -LIB_GCC -LD_FIRSTFLAG LD_SWITCH_SYSTEM_TEMACS LIBGNU_LTLIBDEPS LIBGNU_LIBDEPS @@ -1337,7 +1335,6 @@ W32_LIBS W32_OBJ WINDRES -LIB_STANDARD NS_OBJC_OBJ NS_OBJ ns_self_contained @@ -1352,8 +1349,6 @@ ALSA_CFLAGS LIBSOUND PKG_CONFIG -CRT_DIR -START_FILES LIB_MATH LIBS_SYSTEM C_SWITCH_SYSTEM @@ -1507,7 +1502,6 @@ with_makeinfo with_compress_info with_pkg_config_prog -with_crt_dir with_gameuser with_gnustep_conf enable_ns_self_contained @@ -2236,8 +2230,6 @@ --without-compress-info don't compress the installed Info pages --with-pkg-config-prog=FILENAME file name of pkg-config for finding GTK and librsvg - --with-crt-dir=DIR directory containing crtn.o etc. The default is - /usr/lib, or /usr/lib64 on some platforms. --with-gameuser=USER user for shared game score files --with-gnustep-conf=FILENAME name of GNUstep.conf; default $GNUSTEP_CONFIG_FILE, @@ -3326,7 +3318,6 @@ as_fn_append ac_header_list " sys/systeminfo.h" as_fn_append ac_header_list " coff.h" as_fn_append ac_header_list " pty.h" -as_fn_append ac_header_list " sys/vlimit.h" as_fn_append ac_header_list " sys/resource.h" as_fn_append ac_header_list " sys/utsname.h" as_fn_append ac_header_list " pwd.h" @@ -4368,15 +4359,6 @@ fi fi -CRT_DIR= - -# Check whether --with-crt-dir was given. -if test "${with_crt_dir+set}" = set; then : - withval=$with_crt_dir; -fi - -CRT_DIR="${with_crt_dir}" - # Check whether --with-gameuser was given. if test "${with_gameuser+set}" = set; then : @@ -8571,36 +8553,24 @@ LIB_MATH=-lm -LIB_STANDARD= -START_FILES= SYSTEM_TYPE=`echo $opsys | sed -e 's/[0-9].*//' -e 's|-|/|'` case $opsys in cygwin ) LIB_MATH= - START_FILES='pre-crt0.o' ;; darwin ) ## Adding -lm confuses the dynamic linker, so omit it. LIB_MATH= - START_FILES='pre-crt0.o' ;; freebsd ) - LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o' - START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o' SYSTEM_TYPE=berkeley-unix ;; gnu-linux | gnu-kfreebsd ) - LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o' - START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o' ;; hpux10-20 | hpux11 ) - LIB_STANDARD=-lc - START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o' ;; netbsd | openbsd ) - LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o' - START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o' SYSTEM_TYPE=berkeley-unix ;; @@ -8612,117 +8582,11 @@ - cat >>confdefs.h <<_ACEOF #define SYSTEM_TYPE "$SYSTEM_TYPE" _ACEOF -crt_files= - -for file in x $LIB_STANDARD $START_FILES; do - case "$file" in - *CRT_DIR*) crt_files="$crt_files `echo $file | sed -e 's|.*/||'`" ;; - esac -done - -if test "x$crt_files" != x; then - - ## If user specified a crt-dir, use that unconditionally. - crt_gcc=no - - if test "X$CRT_DIR" = "X"; then - - CRT_DIR=/usr/lib # default - - case "$canonical" in - x86_64-*-linux-gnu* | s390x-*-linux-gnu*) - ## On x86-64 and s390x GNU/Linux distributions, the standard library - ## can be in a variety of places. We only try /usr/lib64 and /usr/lib. - ## For anything else (eg /usr/lib32), it is up the user to specify - ## the location (bug#5655). - ## Test for crtn.o, not just the directory, because sometimes the - ## directory exists but does not have the relevant files (bug#1287). - ## FIXME better to test for binary compatibility somehow. - test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64 - ;; - - powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;; - esac - - case "$opsys" in - hpux10-20) CRT_DIR=/lib ;; - esac - - test "x${GCC}" = xyes && crt_gcc=yes - - fi # CRT_DIR = "" - - crt_missing= - - for file in $crt_files; do - - ## If we're using gcc, try to determine it automatically by asking - ## gcc. [If this doesn't work, CRT_DIR will remain at the - ## system-dependent default from above.] - if test $crt_gcc = yes && test ! -e $CRT_DIR/$file; then - - crt_file=`$CC --print-file-name=$file 2>/dev/null` - case "$crt_file" in - */*) - CRT_DIR=`$as_dirname -- "$crt_file" || -$as_expr X"$crt_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$crt_file" : 'X\(//\)[^/]' \| \ - X"$crt_file" : 'X\(//\)$' \| \ - X"$crt_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$crt_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - ;; - esac - fi - - crt_gcc=no - - test -e $CRT_DIR/$file || crt_missing="$crt_missing $file" - done # $crt_files - - test "x$crt_missing" = x || \ - as_fn_error "Required file(s) not found:$crt_missing -Try using the --with-crt-dir option." "$LINENO" 5 - -fi # crt_files != "" - - - -case $opsys in - netbsd | openbsd ) - if test -f $CRT_DIR/crti.o; then - - test -f $CRT_DIR/crtn.o || \ - as_fn_error "Required file not found: crtn.o" "$LINENO" 5 - - LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o' - START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o' - fi - ;; -esac - pre_PKG_CONFIG_CFLAGS=$CFLAGS pre_PKG_CONFIG_LIBS=$LIBS @@ -8992,8 +8856,6 @@ - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if personality LINUX32 can be set" >&5 $as_echo_n "checking if personality LINUX32 can be set... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9719,8 +9581,6 @@ CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}" LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread" - LIB_STANDARD= - START_FILES= { $as_echo "$as_me:${as_lineno-$LINENO}: checking if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS" >&5 $as_echo_n "checking if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS... " >&6; } if test "${emacs_cv_objc_exceptions+set}" = set; then : @@ -9858,7 +9718,6 @@ - HAVE_W32=no W32_OBJ= W32_LIBS= @@ -10149,6 +10008,50 @@ else test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o VMLIMIT_OBJ=vm-limit.o + + for ac_header in sys/vlimit.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/vlimit.h" "ac_cv_header_sys_vlimit_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_vlimit_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_VLIMIT_H 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for data_start" >&5 +$as_echo_n "checking for data_start... " >&6; } +if test "${emacs_cv_data_start+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern char data_start[]; char ch; +int +main () +{ +return data_start == &ch; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + emacs_cv_data_start=yes +else + emacs_cv_data_start=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_data_start" >&5 +$as_echo "$emacs_cv_data_start" >&6; } + if test $emacs_cv_data_start = yes; then + +$as_echo "#define HAVE_DATA_START 1" >>confdefs.h + + fi fi @@ -15808,28 +15711,16 @@ - case $opsys in - gnu) - $as_echo "#define DATA_START ({ extern int data_start; (char *) &data_start; })" >>confdefs.h - - ;; - aix*) - $as_echo "#define DATA_START 0x20000000" >>confdefs.h - - $as_echo "#define DATA_SEG_BITS 0x20000000" >>confdefs.h + $as_echo "#define DATA_SEG_BITS 0x20000000" >>confdefs.h ;; hpux*) - $as_echo "#define DATA_START 0x40000000" >>confdefs.h - - $as_echo "#define DATA_SEG_BITS 0x40000000" >>confdefs.h + $as_echo "#define DATA_SEG_BITS 0x40000000" >>confdefs.h ;; irix6-5) - $as_echo "#define DATA_START 0x10000000" >>confdefs.h - $as_echo "#define DATA_SEG_BITS 0x10000000" >>confdefs.h ;; @@ -26644,89 +26535,6 @@ - -LD_FIRSTFLAG= -ORDINARY_LINK= -case "$opsys" in - ## gnu: GNU needs its own crt0. - aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;; - - ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the - ## library search parth, i.e. it won't search /usr/lib for libc and - ## friends. Using -nostartfiles instead avoids this problem, and - ## will also work on earlier NetBSD releases. - netbsd|openbsd) LD_FIRSTFLAG="-nostartfiles" ;; - - ## powerpc*: NAKAJI Hiroyuki says - ## MkLinux/LinuxPPC needs this. - ## s390x-* only supports opsys = gnu-linux so it can be added here. - gnu-*) - case "$canonical" in - powerpc*|s390x-*) LD_FIRSTFLAG="-nostdlib" ;; - esac - ;; -esac - - -if test "x$ORDINARY_LINK" = "xyes"; then - - LD_FIRSTFLAG="" - -$as_echo "#define ORDINARY_LINK 1" >>confdefs.h - - -## The system files defining neither ORDINARY_LINK nor LD_FIRSTFLAG are: -## freebsd, gnu-* not on powerpc*|s390x*. -elif test "x$GCC" = "xyes" && test "x$LD_FIRSTFLAG" = "x"; then - - ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure - ## places that are difficult to figure out at make time. Fortunately, - ## these same versions allow you to pass arbitrary flags on to the - ## linker, so there is no reason not to use it as a linker. - ## - ## Well, it is not quite perfect. The "-nostdlib" keeps GCC from - ## searching for libraries in its internal directories, so we have to - ## ask GCC explicitly where to find libgcc.a (LIB_GCC below). - LD_FIRSTFLAG="-nostdlib" -fi - -## FIXME? What setting of EDIT_LDFLAGS should this have? -test "$NS_IMPL_GNUSTEP" = "yes" && LD_FIRSTFLAG="-rdynamic" - - - - -## FIXME? The logic here is not precisely the same as that above. -## There is no check here for a pre-defined LD_FIRSTFLAG. -## Should we only be setting LIB_GCC if LD ~ -nostdlib? -LIB_GCC= -if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then - - case "$opsys" in - freebsd|netbsd|openbsd) LIB_GCC= ;; - - gnu-*) - ## armin76@gentoo.org reported that the lgcc_s flag is necessary to - ## build on ARM EABI under GNU/Linux. (Bug#5518) - case $host_cpu in - arm*) - LIB_GCC="-lgcc_s" - ;; - *) - ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then - ## immediately undefine it again and redefine it to empty. - ## Was the C_SWITCH_X_SITE part really necessary? -## LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name` - LIB_GCC= - ;; - esac - ;; - - ## Ask GCC where to find libgcc.a. - *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;; - esac -fi - ## Common for all window systems if test "$window_system" != "none"; then ------------------------------------------------------------ revno: 111871 committer: Paul Eggert branch nick: trunk timestamp: Sun 2013-02-24 23:49:40 -0800 message: Spelling fixes. diff: === modified file 'test/automated/python-tests.el' --- test/automated/python-tests.el 2013-02-20 20:27:08 +0000 +++ test/automated/python-tests.el 2013-02-25 07:49:40 +0000 @@ -24,7 +24,7 @@ (require 'python) (defmacro python-tests-with-temp-buffer (contents &rest body) - "Create a `python-mode' enabeld temp buffer with CONTENTS. + "Create a `python-mode' enabled temp buffer with CONTENTS. BODY is code to be executed within the temp buffer. Point is always located at the beginning of buffer." (declare (indent 1) (debug t)) @@ -37,7 +37,7 @@ (defun python-tests-look-at (string &optional num restore-point) "Move point at beginning of STRING in the current buffer. Optional argument NUM defaults to 1 and is an integer indicating -how many ocurrences must be found, when positive the search is +how many occurrences must be found, when positive the search is done forwards, otherwise backwards. When RESTORE-POINT is non-nil the point is not moved but the position found is still returned. When searching forward and point is already looking at