------------------------------------------------------------ revno: 115100 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-11-14 00:38:50 -0800 message: * doc/lispref/loading.texi (Library Search): Update section. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-11-11 22:52:08 +0000 +++ doc/lispref/ChangeLog 2013-11-14 08:38:50 +0000 @@ -1,3 +1,7 @@ +2013-11-14 Glenn Morris + + * loading.texi (Library Search): Update section. + 2013-11-11 Xue Fuqiao * os.texi (User Identification, Time of Day, Time Conversion): === modified file 'doc/lispref/loading.texi' --- doc/lispref/loading.texi 2013-06-24 06:58:52 +0000 +++ doc/lispref/loading.texi 2013-11-14 08:38:50 +0000 @@ -253,37 +253,38 @@ in a list of directories specified by the variable @code{load-path}. @defvar load-path -@cindex @env{EMACSLOADPATH} environment variable The value of this variable is a list of directories to search when loading files with @code{load}. Each element is a string (which must be a directory name) or @code{nil} (which stands for the current working directory). @end defvar - Each time Emacs starts up, it sets up the value of @code{load-path} -in several steps. First, it initializes @code{load-path} to the -directories specified by the environment variable @env{EMACSLOADPATH}, -if that exists. The syntax of @env{EMACSLOADPATH} is the same as used -for @code{PATH}; directory names are separated by @samp{:} (or -@samp{;}, on some operating systems), and @samp{.} stands for the -current default directory. Here is an example of how to set -@env{EMACSLOADPATH} variable from @command{sh}: - -@example -export EMACSLOADPATH -EMACSLOADPATH=/home/foo/.emacs.d/lisp:/opt/emacs/lisp -@end example - -@noindent -Here is how to set it from @code{csh}: - -@example -setenv EMACSLOADPATH /home/foo/.emacs.d/lisp:/opt/emacs/lisp -@end example + When Emacs starts up, it sets up the value of @code{load-path} +in several steps. First, it initializes @code{load-path} using +default locations set when Emacs was compiled. Normally, this +is a directory something like + +@example +"/usr/local/share/emacs/@var{version}/lisp" +@end example + +followed by a similarly named @file{leim} directory. These +directories contain the standard Lisp files that come with Emacs. +If Emacs cannot find them, it will not start correctly. + +If you run Emacs from the directory where it was built---that is, an +executable that has not been formally installed---Emacs instead +initializes @code{load-path} using the @file{lisp} and @file{leim} +directories in the directory containing the sources from which it +was built. If you built Emacs in a separate directory from the +sources, it also adds those directories from the build directory. +(In all cases, elements are represented as absolute file names.) @cindex site-lisp directories - If @env{EMACSLOADPATH} is not set (which is usually the case), Emacs -initializes @code{load-path} with the following two directories: +Unless you start Emacs with the @option{--no-site-lisp} option, +it then adds two more @file{site-lisp} directories to the front of +@code{load-path}. These are intended for locally installed Lisp files, +and are normally of the form: @example "/usr/local/share/emacs/@var{version}/site-lisp" @@ -297,26 +298,45 @@ @end example @noindent -The first one is for locally installed packages for a particular Emacs -version; the second is for locally installed packages meant for use -with all installed Emacs versions. - - If you run Emacs from the directory where it was built---that is, an -executable that has not been formally installed---Emacs puts two more -directories in @code{load-path}. These are the @code{lisp} and -@code{site-lisp} subdirectories of the main build directory. (Both -are represented as absolute file names.) - - Next, Emacs ``expands'' the initial list of directories in -@code{load-path} by adding the subdirectories of those directories. -Both immediate subdirectories and subdirectories multiple levels down -are added. But it excludes subdirectories whose names do not start -with a letter or digit, and subdirectories named @file{RCS} or -@file{CVS}, and subdirectories containing a file named -@file{.nosearch}. - - Next, Emacs adds any extra load directory that you specify using the -@samp{-L} command-line option (@pxref{Action Arguments,,,emacs, The +The first one is for locally installed files for a specific Emacs +version; the second is for locally installed files meant for use +with all installed Emacs versions. (If Emacs is running uninstalled, +it also adds @file{site-lisp} directories from the source and build +directories, if they exist. Normally these directories do not contain +@file{site-lisp} directories.) + +@cindex @env{EMACSLOADPATH} environment variable +If the environment variable @env{EMACSLOADPATH} is set, it overrides +the above initialization procedure. That is, Emacs initializes +@code{load-path} based solely on the value of the environment +variable. You must therefore include the directory containing the +standard Lisp files, else Emacs will not function. In most +situations, it is better to use the @option{-L} command-line option +(see below) to add elements to @code{load-path}. + +The syntax of @env{EMACSLOADPATH} is the same as used for @code{PATH}; +directory names are separated by @samp{:} (or @samp{;}, on some +operating systems), and @samp{.} stands for the current default +directory. Here is an example of how to set @env{EMACSLOADPATH} +variable (from a @command{sh}-style shell): + +@example +export EMACSLOADPATH +EMACSLOADPATH=/home/foo/.emacs.d/lisp:/usr/local/emacs/24.3/lisp +@end example + + For each directory in @code{load-path}, Emacs then checks to see if +it contains a file @file{subdirs.el}, and if so, loads it. The +@file{subdirs.el} file is created when Emacs is built/installed, +and contains code that causes Emacs to add any subdirectories of those +directories to @code{load-path}. Both immediate subdirectories and +subdirectories multiple levels down are added. But it excludes +subdirectories whose names do not start with a letter or digit, and +subdirectories named @file{RCS} or @file{CVS}, and subdirectories +containing a file named @file{.nosearch}. + + Next, Emacs adds any extra load directories that you specify using the +@option{-L} command-line option (@pxref{Action Arguments,,,emacs, The GNU Emacs Manual}). It also adds the directories where optional packages are installed, if any (@pxref{Packaging Basics}). ------------------------------------------------------------ revno: 115099 committer: Michael Albinus branch nick: trunk timestamp: Thu 2013-11-14 08:36:39 +0100 message: * net/tramp-gvfs.el (top): Run init code only when `tramp-gvfs-enabled' is not nil. (tramp-gvfs-enabled): Check also :system bus. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-14 02:58:51 +0000 +++ lisp/ChangeLog 2013-11-14 07:36:39 +0000 @@ -1,3 +1,9 @@ +2013-11-14 Michael Albinus + + * net/tramp-gvfs.el (top): Run init code only when + `tramp-gvfs-enabled' is not nil. + (tramp-gvfs-enabled): Check also :system bus. + 2013-11-14 Stefan Monnier Sync with upstream verilog-mode revision 78e66ba. === modified file 'lisp/net/tramp-gvfs.el' --- lisp/net/tramp-gvfs.el 2013-11-13 15:28:06 +0000 +++ lisp/net/tramp-gvfs.el 2013-11-14 07:36:39 +0000 @@ -153,6 +153,7 @@ (defconst tramp-gvfs-enabled (ignore-errors (and (featurep 'dbusbind) + (tramp-compat-funcall 'dbus-get-unique-name :system) (tramp-compat-funcall 'dbus-get-unique-name :session) (or (tramp-compat-process-running-p "gvfs-fuse-daemon") (tramp-compat-process-running-p "gvfsd-fuse")))) @@ -1621,9 +1622,10 @@ :system tramp-bluez-service (dbus-event-path-name last-input-event) tramp-bluez-interface-adapter "StopDiscovery"))))) -(dbus-register-signal - :system nil nil tramp-bluez-interface-adapter "PropertyChanged" - 'tramp-bluez-property-changed) +(when tramp-gvfs-enabled + (dbus-register-signal + :system nil nil tramp-bluez-interface-adapter "PropertyChanged" + 'tramp-bluez-property-changed)) (defun tramp-bluez-device-found (device args) "Signal handler for the \"org.bluez.Adapter.DeviceFound\" signal." @@ -1634,9 +1636,10 @@ ;; device, and call also SDP in order to find the obex service. (add-to-list 'tramp-bluez-devices (list alias address)))) -(dbus-register-signal - :system nil nil tramp-bluez-interface-adapter "DeviceFound" - 'tramp-bluez-device-found) +(when tramp-gvfs-enabled + (dbus-register-signal + :system nil nil tramp-bluez-interface-adapter "DeviceFound" + 'tramp-bluez-device-found)) (defun tramp-bluez-parse-device-names (_ignore) "Return a list of (nil host) tuples allowed to access." @@ -1645,7 +1648,8 @@ (tramp-bluez-list-devices))) ;; Add completion function for OBEX method. -(when (member tramp-bluez-service (dbus-list-known-names :system)) +(when (and tramp-gvfs-enabled + (member tramp-bluez-service (dbus-list-known-names :system))) (tramp-set-completion-function "obex" '((tramp-bluez-parse-device-names "")))) @@ -1678,7 +1682,8 @@ (zeroconf-list-services "_webdav._tcp"))) ;; Add completion function for DAV and DAVS methods. -(when (member zeroconf-service-avahi (dbus-list-known-names :system)) +(when (and tramp-gvfs-enabled + (member zeroconf-service-avahi (dbus-list-known-names :system))) (zeroconf-init tramp-gvfs-zeroconf-domain) (tramp-set-completion-function "sftp" '((tramp-zeroconf-parse-workstation-device-names ""))) @@ -1718,8 +1723,9 @@ (tramp-synce-list-devices))) ;; Add completion function for SYNCE method. -(tramp-set-completion-function - "synce" '((tramp-synce-parse-device-names ""))) +(when tramp-gvfs-enabled + (tramp-set-completion-function + "synce" '((tramp-synce-parse-device-names "")))) (add-hook 'tramp-unload-hook (lambda () ------------------------------------------------------------ revno: 115098 author: Stefan Monnier committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-11-13 18:58:51 -0800 message: Sync with upstream verilog-mode revision 78e66ba. * lisp/progmodes/verilog-mode.el (verilog-end-of-defun) (verilog-type-completion, verilog-get-list): Remove unused funcs. (verilog-get-end-of-defun): Remove unused argument. (verilog-comment-depth): Remove unused local `e'. (verilog-read-decls, verilog-read-sub-decls, verilog-read-instants): Don't pass arg to verilog-get-end-of-defun. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-14 02:44:54 +0000 +++ lisp/ChangeLog 2013-11-14 02:58:51 +0000 @@ -1,3 +1,13 @@ +2013-11-14 Stefan Monnier + + Sync with upstream verilog-mode revision 78e66ba. + * progmodes/verilog-mode.el (verilog-end-of-defun) + (verilog-type-completion, verilog-get-list): Remove unused funcs. + (verilog-get-end-of-defun): Remove unused argument. + (verilog-comment-depth): Remove unused local `e'. + (verilog-read-decls, verilog-read-sub-decls, verilog-read-instants): + Don't pass arg to verilog-get-end-of-defun. + 2013-11-14 Glenn Morris * obsolete/assoc.el (aget): Prefix dynamic variable. === modified file 'lisp/progmodes/verilog-mode.el' --- lisp/progmodes/verilog-mode.el 2013-11-05 07:44:14 +0000 +++ lisp/progmodes/verilog-mode.el 2013-11-14 02:58:51 +0000 @@ -123,7 +123,7 @@ ;;; Code: ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version "2013-10-09-1a6ecec-vpo" +(defconst verilog-mode-version "2013-11-05-78e66ba-vpo" "Version of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -163,12 +163,12 @@ (condition-case nil (if (fboundp 'store-match-data) nil ;; fab - (defmacro store-match-data (&rest args) nil)) + (defmacro store-match-data (&rest _args) nil)) (error nil)) (condition-case nil (if (fboundp 'char-before) nil ;; great - (defmacro char-before (&rest body) + (defmacro char-before (&rest _body) (char-after (1- (point))))) (error nil)) (condition-case nil @@ -210,23 +210,23 @@ (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) nil ;; We've got what we needed ;; We have the old custom-library, hack around it! - (defmacro defgroup (&rest args) nil) - (defmacro customize (&rest args) + (defmacro defgroup (&rest _args) nil) + (defmacro customize (&rest _args) (message "Sorry, Customize is not available with this version of Emacs")) - (defmacro defcustom (var value doc &rest args) + (defmacro defcustom (var value doc &rest _args) `(defvar ,var ,value ,doc)) ) (if (fboundp 'defface) nil ; great! - (defmacro defface (var values doc &rest args) + (defmacro defface (var values doc &rest _args) `(make-face ,var)) ) (if (and (featurep 'custom) (fboundp 'customize-group)) nil ;; We've got what we needed ;; We have an intermediate custom-library, hack around it! - (defmacro customize-group (var &rest args) + (defmacro customize-group (var &rest _args) `(customize ,var)) ) @@ -259,23 +259,23 @@ ;with just a two input regexp (defun verilog-regexp-opt (a b) "Deal with differing number of required arguments for `regexp-opt'. - Call 'regexp-opt' on A and B." - (regexp-opt a b 't)) + Call `regexp-opt' on A and B." + (regexp-opt a b t)) (error nil)) ) ((eq args 2) ;; It takes 2 (defun verilog-regexp-opt (a b) - "Call 'regexp-opt' on A and B." + "Call `regexp-opt' on A and B." (regexp-opt a b)) ) (t nil))) ;; We can't tell; assume it takes 2 (defun verilog-regexp-opt (a b) - "Call 'regexp-opt' on A and B." + "Call `regexp-opt' on A and B." (regexp-opt a b)) ) ;; There is no regexp-opt, provide our own - (defun verilog-regexp-opt (strings &optional paren shy) + (defun verilog-regexp-opt (strings &optional paren _shy) (let ((open (if paren "\\(" "")) (close (if paren "\\)" ""))) (concat open (mapconcat 'regexp-quote strings "\\|") close))) ) @@ -4081,14 +4081,7 @@ (interactive) (verilog-re-search-forward verilog-end-defun-re nil 'move)) -(defun verilog-get-beg-of-defun (&optional warn) - (save-excursion - (cond ((verilog-re-search-forward-quick verilog-defun-re nil t) - (point)) - (t - (error "%s: Can't find module beginning" (verilog-point-text)) - (point-max))))) -(defun verilog-get-end-of-defun (&optional warn) +(defun verilog-get-end-of-defun () (save-excursion (cond ((verilog-re-search-forward-quick verilog-end-defun-re nil t) (point)) @@ -6486,9 +6479,9 @@ (looking-at "\*"))) (insert "* "))))) -(defun verilog-comment-indent (&optional arg) +(defun verilog-comment-indent (&optional _arg) "Return the column number the line should be indented to. -ARG is ignored, for `comment-indent-function' compatibility." +_ARG is ignored, for `comment-indent-function' compatibility." (cond ((verilog-in-star-comment-p) (save-excursion @@ -6650,8 +6643,8 @@ (forward-line 1)) (unless quiet (message ""))))))) -(defun verilog-pretty-expr (&optional quiet myre) - "Line up expressions around point, optionally QUIET with regexp MYRE ignored." +(defun verilog-pretty-expr (&optional quiet _myre) + "Line up expressions around point, optionally QUIET with regexp _MYRE ignored." (interactive) (if (not (verilog-in-comment-or-string-p)) (save-excursion @@ -6888,8 +6881,7 @@ ((b (prog2 (beginning-of-line) (point-marker) - (end-of-line))) - (e (point-marker))) + (end-of-line)))) (if (re-search-backward " /\\* \[#-\]# \[a-zA-Z\]+ \[0-9\]+ ## \\*/" b t) (progn (replace-match " /* -# ## */") @@ -7081,24 +7073,6 @@ (forward-line 1))) verilog-all) -(defun verilog-type-completion () - "Calculate all possible completions for types." - (let ((start (point)) - goon) - ;; Search for all reachable type declarations - (while (or (verilog-beg-of-defun) - (setq goon (not goon))) - (save-excursion - (if (and (< start (prog1 (save-excursion (verilog-end-of-defun) - (point)) - (forward-char 1))) - (verilog-re-search-forward - "\\\\|\\<\\(begin\\|function\\|procedure\\)\\>" - start t) - (not (match-end 1))) - ;; Check current type declaration - (verilog-get-completion-decl start)))))) - (defun verilog-var-completion () "Calculate all possible completions for variables (or constants)." (let ((start (point))) @@ -7182,6 +7156,7 @@ ;; Return nil if there was no matching label nil ;; Get longest string common in the labels + ;; FIXME: Why not use `try-completion'? (let* ((elm (cdr verilog-all)) (match (car verilog-all)) (min (length match)) @@ -7218,6 +7193,7 @@ "Complete word at current point. \(See also `verilog-toggle-completions', `verilog-type-keywords', and `verilog-separator-keywords'.)" + ;; FIXME: Provide completion-at-point-function. (interactive) (let* ((b (save-excursion (skip-chars-backward "a-zA-Z0-9_") (point))) (e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point))) @@ -7789,6 +7765,7 @@ "Return list of signals in IN-LIST that aren't parameters or numeric constants." (let (out-list) (while in-list + ;; Namespace intentionally short for AUTOs and compatibility (unless (boundp (intern (concat "vh-" (verilog-sig-name (car in-list))))) (setq out-list (cons (car in-list) out-list))) (setq in-list (cdr in-list))) @@ -8086,7 +8063,7 @@ (defun verilog-read-decls () "Compute signal declaration information for the current module at point. Return an array of [outputs inouts inputs wire reg assign const]." - (let ((end-mod-point (or (verilog-get-end-of-defun t) (point-max))) + (let ((end-mod-point (or (verilog-get-end-of-defun) (point-max))) (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t) in-modport in-clocking ptype ign-prop sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const @@ -8592,7 +8569,7 @@ // Inputs .in (in));" (save-excursion - (let ((end-mod-point (verilog-get-end-of-defun t)) + (let ((end-mod-point (verilog-get-end-of-defun)) st-point end-inst-point ;; below 3 modified by verilog-read-sub-decls-line sigs-out sigs-inout sigs-in sigs-intf sigs-intfd) @@ -8887,7 +8864,7 @@ (defun verilog-read-instants () "Parse module at point and return list of ( ( file instance ) ... )." (verilog-beg-of-defun-quick) - (let* ((end-mod-point (verilog-get-end-of-defun t)) + (let* ((end-mod-point (verilog-get-end-of-defun)) (state nil) (instants-list nil)) (save-excursion @@ -9034,12 +9011,14 @@ "Set the definition DEFNAME to the DEFVALUE in the given BUFFER. Optionally associate it with the specified enumeration ENUMNAME." (with-current-buffer (or buffer (current-buffer)) + ;; Namespace intentionally short for AUTOs and compatibility (let ((mac (intern (concat "vh-" defname)))) ;;(message "Define %s=%s" defname defvalue) (sleep-for 1) ;; Need to define to a constant if no value given (set (make-local-variable mac) (if (equal defvalue "") "1" defvalue))) (if enumname + ;; Namespace intentionally short for AUTOs and compatibility (let ((enumvar (intern (concat "venum-" enumname)))) ;;(message "Define %s=%s" defname defvalue) (sleep-for 1) (unless (boundp enumvar) (set enumvar nil)) @@ -9424,10 +9403,12 @@ (while (and symbol (string-match "^`" symbol)) (setq symbol (substring symbol 1)) (setq symbol + ;; Namespace intentionally short for AUTOs and compatibility (if (boundp (intern (concat "vh-" symbol))) ;; Emacs has a bug where boundp on a buffer-local ;; variable in only one buffer returns t in another. ;; This can confuse, so check for nil. + ;; Namespace intentionally short for AUTOs and compatibility (let ((val (eval (intern (concat "vh-" symbol))))) (if (eq val nil) (if wing-it symbol nil) @@ -9460,10 +9441,12 @@ (setq symbol (match-string 1 text)) ;;(message symbol) (cond ((and + ;; Namespace intentionally short for AUTOs and compatibility (boundp (intern (concat "vh-" symbol))) ;; Emacs has a bug where boundp on a buffer-local ;; variable in only one buffer returns t in another. ;; This can confuse, so check for nil. + ;; Namespace intentionally short for AUTOs and compatibility (setq val (eval (intern (concat "vh-" symbol))))) (setq text (replace-match val nil nil text))) (t (setq ok nil))))) @@ -9807,6 +9790,7 @@ (setq out-list (cons (car in-list) out-list))) (setq in-list (cdr in-list))) ;; New scheme + ;; Namespace intentionally short for AUTOs and compatibility (let* ((enumvar (intern (concat "venum-" enum))) (enumlist (and (boundp enumvar) (eval enumvar)))) (while enumlist @@ -10033,19 +10017,6 @@ (when (looking-at ",") (delete-char 1)))) -(defun verilog-get-list (start end) - "Return the elements of a comma separated list between START and END." - (interactive) - (let ((my-list (list)) - my-string) - (save-excursion - (while (< (point) end) - (when (re-search-forward "\\([^,{]+\\)" end t) - (setq my-string (verilog-string-remove-spaces (match-string 1))) - (setq my-list (nconc my-list (list my-string) )) - (goto-char (match-end 0)))) - my-list))) - (defun verilog-make-width-expression (range-exp) "Return an expression calculating the length of a range [x:y] in RANGE-EXP." ;; strip off the [] @@ -10799,7 +10770,7 @@ (setq sigs (cdr sigs)))) (verilog-insert-indent "// End of automatics\n"))))))) -(defun verilog-auto-inst-port-map (port-st) +(defun verilog-auto-inst-port-map (_port-st) nil) (defvar vl-cell-type nil "See `verilog-auto-inst'.") ; Prevent compile warning @@ -10887,7 +10858,7 @@ (setq expr (verilog-string-replace-matches "\\\\\"" "\"" nil nil expr)) (setq expr (verilog-string-replace-matches "@" tpl-num nil nil expr)) (prin1 (eval (car (read-from-string expr))) - (lambda (ch) ()))))) + (lambda (_ch) ()))))) (if (numberp value) (setq value (number-to-string value))) value)) (substring tpl-net (match-end 0)))))) @@ -12303,7 +12274,7 @@ Interface names must be resolvable to filenames. See `verilog-auto-inst'. As with other autos, any inputs/outputs declared in the module -will suppress the AUTO from redeclaring an input/output by +will suppress the AUTO from redeclaring an inputs/outputs by the same name. An example: @@ -13766,7 +13737,7 @@ "Map containing mouse bindings for `verilog-mode'.") -(defun verilog-highlight-region (beg end old-len) +(defun verilog-highlight-region (beg end _old-len) "Colorize included files and modules in the (changed?) region. Clicking on the middle-mouse button loads them in a buffer (as in dired)." (when (or verilog-highlight-includes ------------------------------------------------------------ revno: 115097 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-11-13 18:44:54 -0800 message: * lisp/obsolete/assoc.el (aget): Prefix dynamic variable. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-14 00:41:58 +0000 +++ lisp/ChangeLog 2013-11-14 02:44:54 +0000 @@ -1,3 +1,9 @@ +2013-11-14 Glenn Morris + + * obsolete/assoc.el (aget): Prefix dynamic variable. + + * allout-widgets.el (allout-widgets): No need to autoload defgroup. + 2013-11-14 Stefan Monnier * widget.el, hfy-cmap.el: Remove bogus package version number. === modified file 'lisp/obsolete/assoc.el' --- lisp/obsolete/assoc.el 2013-01-01 09:11:05 +0000 +++ lisp/obsolete/assoc.el 2013-11-14 02:44:54 +0000 @@ -102,14 +102,14 @@ If no key-value pair matching KEY could be found in ALIST, or ALIST is nil then nil is returned. ALIST is not altered." - (defvar copy) - (let ((copy (copy-alist alist))) + (defvar assoc--copy) + (let ((assoc--copy (copy-alist alist))) (cond ((null alist) nil) - ((progn (asort 'copy key) - (anot-head-p copy key)) nil) - ((cdr (car copy))) + ((progn (asort 'assoc--copy key) ; dynamic binding + (anot-head-p assoc--copy key)) nil) + ((cdr (car assoc--copy))) (keynil-p nil) - ((car (car copy))) + ((car (car assoc--copy))) (t nil)))) ------------------------------------------------------------ revno: 115096 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-11-13 18:43:55 -0800 message: * lisp/allout-widgets.el (allout-widgets): No need to autoload defgroup. diff: === modified file 'lisp/allout-widgets.el' --- lisp/allout-widgets.el 2013-08-08 23:59:14 +0000 +++ lisp/allout-widgets.el 2013-11-14 02:43:55 +0000 @@ -90,7 +90,6 @@ ;;;_ : USER CUSTOMIZATION VARIABLES and incidental functions: ;;;_ > defgroup allout-widgets -;;;###autoload (defgroup allout-widgets nil "Allout extension that highlights outline structure graphically. ------------------------------------------------------------ revno: 115095 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-11-13 18:39:28 -0800 message: Simplify, port and tune bool vector implementation. * configure.ac (BITSIZEOF_SIZE_T, SIZEOF_SIZE_T): Remove. * src/alloc.c (bool_vector_exact_payload_bytes) (bool_vector_payload_bytes): Remove. (bool_vector_fill): Return its argument. * src/alloc.c (bool_vector_fill): * src/lread.c (read1): * src/print.c (print_object): Simplify by using bool_vector_bytes. * src/alloc.c (make_uninit_bool_vector): New function, broken out from Fmake_bool_vector. (Fmake_bool_vector): Use it. Use tail call. (make_uninit_bool_vector, vector_nbytes): Simplify size calculations. * src/data.c (BITS_PER_ULL): New constant. (ULLONG_MAX, count_one_bits_ll): Fall back on long counterparts if long long versions don't exist. (shift_right_ull): New function. (count_one_bits_word): New function, replacing popcount_bits_word macro. Don't assume that bits_word is no wider than long long. (count_one_bits_word, count_trailing_zero_bits): Don't assume that bits_word is no wider than long long. * src/data.c (bool_vector_binop_driver, bool_vector_not): * src/fns.c (Fcopy_sequence): * src/lread.c (read1): Create an uninitialized destination, to avoid needless work. (internal_equal): Simplify. (Ffillarray): Prefer tail call. * src/data.c (bool_vector_binop_driver): Don't assume bit vectors always contain at least one word. (bits_word_to_host_endian): Prefer if to #if. Don't assume chars are narrower than ints. * src/data.c (Fbool_vector_count_matches, Fbool_vector_count_matches_at): * src/fns.c (Fcopy_sequence): Simplify and tune. * src/lisp.h (bits_word, BITS_WORD_MAX, BITS_PER_BITS_WORD): Don't try to port to hosts where bits_word values have holes; the code wouldn't work there anyway. Verify this assumption, though. (bool_vector_bytes): New function. (make_uninit_bool_vector): New decl. (bool_vector_fill): Now returns Lisp_Object. diff: === modified file 'ChangeLog' --- ChangeLog 2013-11-13 08:04:57 +0000 +++ ChangeLog 2013-11-14 02:39:28 +0000 @@ -1,3 +1,8 @@ +2013-11-14 Paul Eggert + + Simplify, port and tune bool vector implementation. + * configure.ac (BITSIZEOF_SIZE_T, SIZEOF_SIZE_T): Remove. + 2013-11-13 Paul Eggert * Makefile.in (ACLOCAL_INPUTS): Add configure.ac. === modified file 'configure.ac' --- configure.ac 2013-11-12 03:01:07 +0000 +++ configure.ac 2013-11-14 02:39:28 +0000 @@ -4720,8 +4720,6 @@ gl_ASSERT_NO_GNULIB_POSIXCHECK gl_ASSERT_NO_GNULIB_TESTS gl_INIT -gl_STDINT_BITSIZEOF([size_t], [[#include ]]) -AC_CHECK_SIZEOF([size_t]) CFLAGS=$SAVE_CFLAGS LIBS=$SAVE_LIBS === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-14 01:52:18 +0000 +++ src/ChangeLog 2013-11-14 02:39:28 +0000 @@ -1,5 +1,45 @@ 2013-11-14 Paul Eggert + Simplify, port and tune bool vector implementation. + * alloc.c (bool_vector_exact_payload_bytes) + (bool_vector_payload_bytes): Remove. + (bool_vector_fill): Return its argument. + * alloc.c (bool_vector_fill): + * lread.c (read1): + * print.c (print_object): + Simplify by using bool_vector_bytes. + * alloc.c (make_uninit_bool_vector): + New function, broken out from Fmake_bool_vector. + (Fmake_bool_vector): Use it. Use tail call. + (make_uninit_bool_vector, vector_nbytes): Simplify size calculations. + * data.c (BITS_PER_ULL): New constant. + (ULLONG_MAX, count_one_bits_ll): Fall back on long counterparts + if long long versions don't exist. + (shift_right_ull): New function. + (count_one_bits_word): New function, replacing popcount_bits_word + macro. Don't assume that bits_word is no wider than long long. + (count_one_bits_word, count_trailing_zero_bits): + Don't assume that bits_word is no wider than long long. + * data.c (bool_vector_binop_driver, bool_vector_not): + * fns.c (Fcopy_sequence): + * lread.c (read1): + Create an uninitialized destination, to avoid needless work. + (internal_equal): Simplify. + (Ffillarray): Prefer tail call. + * data.c (bool_vector_binop_driver): Don't assume bit vectors always + contain at least one word. + (bits_word_to_host_endian): Prefer if to #if. Don't assume + chars are narrower than ints. + * data.c (Fbool_vector_count_matches, Fbool_vector_count_matches_at): + * fns.c (Fcopy_sequence): + Simplify and tune. + * lisp.h (bits_word, BITS_WORD_MAX, BITS_PER_BITS_WORD): + Don't try to port to hosts where bits_word values have holes; the + code wouldn't work there anyway. Verify this assumption, though. + (bool_vector_bytes): New function. + (make_uninit_bool_vector): New decl. + (bool_vector_fill): Now returns Lisp_Object. + * xfns.c (xic_create_fontsetname): * xrdb.c (gethomedir): Prefer tail calls. === modified file 'src/alloc.c' --- src/alloc.c 2013-11-07 05:31:04 +0000 +++ src/alloc.c 2013-11-14 02:39:28 +0000 @@ -2041,26 +2041,10 @@ return val; } -static EMACS_INT -bool_vector_exact_payload_bytes (EMACS_INT nbits) -{ - eassume (0 <= nbits); - return (nbits + BOOL_VECTOR_BITS_PER_CHAR - 1) / BOOL_VECTOR_BITS_PER_CHAR; -} - -static EMACS_INT -bool_vector_payload_bytes (EMACS_INT nbits) -{ - EMACS_INT exact_needed_bytes = bool_vector_exact_payload_bytes (nbits); - - /* Always allocate at least one machine word of payload so that - bool-vector operations in data.c don't need a special case - for empty vectors. */ - return ROUNDUP (exact_needed_bytes + !exact_needed_bytes, - sizeof (bits_word)); -} - -void +/* Fill A with 1 bits if INIT is non-nil, and with 0 bits otherwise. + Return A. */ + +Lisp_Object bool_vector_fill (Lisp_Object a, Lisp_Object init) { EMACS_INT nbits = bool_vector_size (a); @@ -2068,48 +2052,50 @@ { unsigned char *data = bool_vector_uchar_data (a); int pattern = NILP (init) ? 0 : (1 << BOOL_VECTOR_BITS_PER_CHAR) - 1; - ptrdiff_t nbytes = ((nbits + BOOL_VECTOR_BITS_PER_CHAR - 1) - / BOOL_VECTOR_BITS_PER_CHAR); + ptrdiff_t nbytes = bool_vector_bytes (nbits); int last_mask = ~ (~0 << ((nbits - 1) % BOOL_VECTOR_BITS_PER_CHAR + 1)); memset (data, pattern, nbytes - 1); data[nbytes - 1] = pattern & last_mask; } + return a; } -DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, - doc: /* Return a new bool-vector of length LENGTH, using INIT for each element. -LENGTH must be a number. INIT matters only in whether it is t or nil. */) - (Lisp_Object length, Lisp_Object init) +/* Return a newly allocated, uninitialized bool vector of size NBITS. */ + +Lisp_Object +make_uninit_bool_vector (EMACS_INT nbits) { Lisp_Object val; struct Lisp_Bool_Vector *p; - EMACS_INT exact_payload_bytes, total_payload_bytes, needed_elements; - - CHECK_NATNUM (length); - - exact_payload_bytes = bool_vector_exact_payload_bytes (XFASTINT (length)); - total_payload_bytes = bool_vector_payload_bytes (XFASTINT (length)); - - needed_elements = ((bool_header_size - header_size + total_payload_bytes + EMACS_INT word_bytes, needed_elements; + word_bytes = bool_vector_words (nbits) * sizeof (bits_word); + needed_elements = ((bool_header_size - header_size + word_bytes + word_size - 1) / word_size); - p = (struct Lisp_Bool_Vector *) allocate_vector (needed_elements); XSETVECTOR (val, p); XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0, 0); - - p->size = XFASTINT (length); - bool_vector_fill (val, init); + p->size = nbits; /* Clear padding at the end. */ - eassume (exact_payload_bytes <= total_payload_bytes); - memset (bool_vector_uchar_data (val) + exact_payload_bytes, - 0, - total_payload_bytes - exact_payload_bytes); + if (nbits) + p->data[bool_vector_words (nbits) - 1] = 0; return val; } +DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, + doc: /* Return a new bool-vector of length LENGTH, using INIT for each element. +LENGTH must be a number. INIT matters only in whether it is t or nil. */) + (Lisp_Object length, Lisp_Object init) +{ + Lisp_Object val; + + CHECK_NATNUM (length); + val = make_uninit_bool_vector (XFASTINT (length)); + return bool_vector_fill (val, init); +} + /* Make a string from NBYTES bytes at CONTENTS, and compute the number of characters from the contents. This string may be unibyte or @@ -2858,24 +2844,27 @@ vector_nbytes (struct Lisp_Vector *v) { ptrdiff_t size = v->header.size & ~ARRAY_MARK_FLAG; + ptrdiff_t nwords; if (size & PSEUDOVECTOR_FLAG) { if (PSEUDOVECTOR_TYPEP (&v->header, PVEC_BOOL_VECTOR)) { struct Lisp_Bool_Vector *bv = (struct Lisp_Bool_Vector *) v; - ptrdiff_t payload_bytes = bool_vector_payload_bytes (bv->size); - size = bool_header_size + payload_bytes; + ptrdiff_t word_bytes = (bool_vector_words (bv->size) + * sizeof (bits_word)); + ptrdiff_t boolvec_bytes = bool_header_size + word_bytes; + verify (header_size <= bool_header_size); + nwords = (boolvec_bytes - header_size + word_size - 1) / word_size; } else - size = (header_size - + ((size & PSEUDOVECTOR_SIZE_MASK) - + ((size & PSEUDOVECTOR_REST_MASK) - >> PSEUDOVECTOR_SIZE_BITS)) * word_size); + nwords = ((size & PSEUDOVECTOR_SIZE_MASK) + + ((size & PSEUDOVECTOR_REST_MASK) + >> PSEUDOVECTOR_SIZE_BITS)); } else - size = header_size + size * word_size; - return vroundup (size); + nwords = size; + return vroundup (header_size + word_size * nwords); } /* Release extra resources still in use by VECTOR, which may be any === modified file 'src/data.c' --- src/data.c 2013-11-05 07:11:24 +0000 +++ src/data.c 2013-11-14 02:39:28 +0000 @@ -2962,9 +2962,7 @@ /* Because we round up the bool vector allocate size to word_size units, we can safely read past the "end" of the vector in the - operations below. These extra bits are always zero. Also, we - always allocate bool vectors with at least one bits_word of storage so - that we don't have to special-case empty bit vectors. */ + operations below. These extra bits are always zero. */ static bits_word bool_vector_spare_mask (EMACS_INT nr_bits) @@ -2972,16 +2970,47 @@ return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1; } -#if BITS_WORD_MAX <= UINT_MAX -# define popcount_bits_word count_one_bits -#elif BITS_WORD_MAX <= ULONG_MAX -# define popcount_bits_word count_one_bits_l -#elif BITS_WORD_MAX <= ULLONG_MAX -# define popcount_bits_word count_one_bits_ll +/* Info about unsigned long long, falling back on unsigned long + if unsigned long long is not available. */ + +#if HAVE_UNSIGNED_LONG_LONG_INT +enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long long) }; #else -# error "bits_word wider than long long? Please file a bug report." +enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long) }; +# define ULLONG_MAX ULONG_MAX +# define count_one_bits_ll count_one_bits_l #endif +/* Shift VAL right by the width of an unsigned long long. + BITS_PER_ULL must be less than BITS_PER_BITS_WORD. */ + +static bits_word +shift_right_ull (bits_word w) +{ + /* Pacify bogus GCC warning about shift count exceeding type width. */ + int shift = BITS_PER_ULL - BITS_PER_BITS_WORD < 0 ? BITS_PER_ULL : 0; + return w >> shift; +} + +/* Return the number of 1 bits in W. */ + +static int +count_one_bits_word (bits_word w) +{ + if (BITS_WORD_MAX <= UINT_MAX) + return count_one_bits (w); + else if (BITS_WORD_MAX <= ULONG_MAX) + return count_one_bits_l (w); + else + { + int i = 0, count = 0; + while (count += count_one_bits_ll (w), + BITS_PER_BITS_WORD <= (i += BITS_PER_ULL)) + w = shift_right_ull (w); + return count; + } +} + enum bool_vector_op { bool_vector_exclusive_or, bool_vector_union, bool_vector_intersection, @@ -2997,7 +3026,7 @@ EMACS_INT nr_bits; bits_word *adata, *bdata, *cdata; ptrdiff_t i; - bits_word changed = 0; + bool changed = 0; bits_word mword; ptrdiff_t nr_words; @@ -3010,7 +3039,7 @@ if (NILP (dest)) { - dest = Fmake_bool_vector (make_number (nr_bits), Qnil); + dest = make_uninit_bool_vector (nr_bits); changed = 1; } else @@ -3025,8 +3054,8 @@ adata = bool_vector_data (dest); bdata = bool_vector_data (op1); cdata = bool_vector_data (op2); - i = 0; - do + + for (i = 0; i < nr_words; i++) { if (op == bool_vector_exclusive_or) mword = bdata[i] ^ cdata[i]; @@ -3039,14 +3068,12 @@ else abort (); - changed |= adata[i] ^ mword; + if (! changed) + changed = adata[i] != mword; if (op != bool_vector_subsetp) adata[i] = mword; - - i++; } - while (i < nr_words); return changed ? dest : Qnil; } @@ -3060,27 +3087,33 @@ return count_trailing_zeros (val); if (BITS_WORD_MAX == ULONG_MAX) return count_trailing_zeros_l (val); -# if HAVE_UNSIGNED_LONG_LONG_INT if (BITS_WORD_MAX == ULLONG_MAX) return count_trailing_zeros_ll (val); -# endif /* The rest of this code is for the unlikely platform where bits_word differs in width from unsigned int, unsigned long, and unsigned long long. */ - if (val == 0) - return CHAR_BIT * sizeof (val); + val |= ~ BITS_WORD_MAX; if (BITS_WORD_MAX <= UINT_MAX) return count_trailing_zeros (val); if (BITS_WORD_MAX <= ULONG_MAX) return count_trailing_zeros_l (val); - { -# if HAVE_UNSIGNED_LONG_LONG_INT - verify (BITS_WORD_MAX <= ULLONG_MAX); - return count_trailing_zeros_ll (val); -# else - verify (BITS_WORD_MAX <= ULONG_MAX); -# endif - } + else + { + int count; + for (count = 0; + count < BITS_PER_BITS_WORD - BITS_PER_ULL; + count += BITS_PER_ULL) + { + if (val & ULLONG_MAX) + return count + count_trailing_zeros_ll (val); + val = shift_right_ull (val); + } + + if (BITS_PER_BITS_WORD % BITS_PER_ULL != 0 + && BITS_WORD_MAX == (bits_word) -1) + val |= (bits_word) 1 << (BITS_PER_BITS_WORD % BITS_PER_ULL); + return count + count_trailing_zeros_ll (val); + } } static bits_word @@ -3088,20 +3121,24 @@ { #ifndef WORDS_BIGENDIAN return val; -#elif BITS_WORD_MAX >> 31 == 1 - return bswap_32 (val); -#elif BITS_WORD_MAX >> 31 >> 31 >> 1 == 1 - return bswap_64 (val); #else - int i; - bits_word r = 0; - for (i = 0; i < sizeof val; i++) - { - r = ((r << 1 << (CHAR_BIT - 1)) - | (val & ((1u << 1 << (CHAR_BIT - 1)) - 1))); - val = val >> 1 >> (CHAR_BIT - 1); - } - return r; + if (BITS_WORD_MAX >> 31 == 1) + return bswap_32 (val); +# if HAVE_UNSIGNED_LONG_LONG + if (BITS_WORD_MAX >> 31 >> 31 >> 1 == 1) + return bswap_64 (val); +# endif + { + int i; + bits_word r = 0; + for (i = 0; i < sizeof val; i++) + { + r = ((r << 1 << (CHAR_BIT - 1)) + | (val & ((1u << 1 << (CHAR_BIT - 1)) - 1))); + val = val >> 1 >> (CHAR_BIT - 1); + } + return r; + } #endif } @@ -3174,7 +3211,7 @@ nr_bits = bool_vector_size (a); if (NILP (b)) - b = Fmake_bool_vector (make_number (nr_bits), Qnil); + b = make_uninit_bool_vector (nr_bits); else { CHECK_BOOL_VECTOR (b); @@ -3208,27 +3245,20 @@ EMACS_INT count; EMACS_INT nr_bits; bits_word *adata; - bits_word match; - ptrdiff_t i; + ptrdiff_t i, nwords; CHECK_BOOL_VECTOR (a); nr_bits = bool_vector_size (a); + nwords = bool_vector_words (nr_bits); count = 0; - match = NILP (b) ? BITS_WORD_MAX : 0; adata = bool_vector_data (a); - for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; ++i) - count += popcount_bits_word (adata[i] ^ match); - - /* Mask out trailing parts of final mword. */ - if (nr_bits % BITS_PER_BITS_WORD) - { - bits_word mword = adata[i] ^ match; - mword = bits_word_to_host_endian (mword); - count += popcount_bits_word (mword & bool_vector_spare_mask (nr_bits)); - } - + for (i = 0; i < nwords; i++) + count += count_one_bits_word (adata[i]); + + if (NILP (b)) + count = nr_bits - count; return make_number (count); } @@ -3246,7 +3276,7 @@ bits_word *adata; bits_word twiddle; bits_word mword; /* Machine word. */ - ptrdiff_t pos; + ptrdiff_t pos, pos0; ptrdiff_t nr_words; CHECK_BOOL_VECTOR (a); @@ -3273,8 +3303,8 @@ mword = bits_word_to_host_endian (adata[pos]); mword ^= twiddle; mword >>= offset; + mword |= (bits_word) 1 << (BITS_PER_BITS_WORD - offset); count = count_trailing_zero_bits (mword); - count = min (count, BITS_PER_BITS_WORD - offset); pos++; if (count + offset < BITS_PER_BITS_WORD) return make_number (count); @@ -3283,11 +3313,10 @@ /* Scan whole words until we either reach the end of the vector or find an mword that doesn't completely match. twiddle is endian-independent. */ + pos0 = pos; while (pos < nr_words && adata[pos] == twiddle) - { - count += BITS_PER_BITS_WORD; - ++pos; - } + pos++; + count += (pos - pos0) * BITS_PER_BITS_WORD; if (pos < nr_words) { === modified file 'src/fns.c' --- src/fns.c 2013-11-05 07:11:24 +0000 +++ src/fns.c 2013-11-14 02:39:28 +0000 @@ -435,13 +435,10 @@ if (BOOL_VECTOR_P (arg)) { - Lisp_Object val; - ptrdiff_t size_in_chars - = ((bool_vector_size (arg) + BOOL_VECTOR_BITS_PER_CHAR - 1) - / BOOL_VECTOR_BITS_PER_CHAR); - - val = Fmake_bool_vector (Flength (arg), Qnil); - memcpy (bool_vector_data (val), bool_vector_data (arg), size_in_chars); + EMACS_INT nbits = bool_vector_size (arg); + ptrdiff_t nbytes = bool_vector_bytes (nbits); + Lisp_Object val = make_uninit_bool_vector (nbits); + memcpy (bool_vector_data (val), bool_vector_data (arg), nbytes); return val; } @@ -2066,8 +2063,7 @@ if (size != bool_vector_size (o2)) return 0; if (memcmp (bool_vector_data (o1), bool_vector_data (o2), - ((size + BOOL_VECTOR_BITS_PER_CHAR - 1) - / BOOL_VECTOR_BITS_PER_CHAR))) + bool_vector_bytes (size))) return 0; return 1; } @@ -2157,7 +2153,7 @@ p[idx] = charval; } else if (BOOL_VECTOR_P (array)) - bool_vector_fill (array, item); + return bool_vector_fill (array, item); else wrong_type_argument (Qarrayp, array); return array; === modified file 'src/lisp.h' --- src/lisp.h 2013-11-05 22:45:44 +0000 +++ src/lisp.h 2013-11-14 02:39:28 +0000 @@ -92,16 +92,16 @@ /* An unsigned integer type representing a fixed-length bit sequence, suitable for words in a Lisp bool vector. Normally it is size_t for speed, but it is unsigned char on weird platforms. */ -#if (BITSIZEOF_SIZE_T == CHAR_BIT * SIZEOF_SIZE_T \ - && BOOL_VECTOR_BITS_PER_CHAR == CHAR_BIT) +#if BOOL_VECTOR_BITS_PER_CHAR == CHAR_BIT typedef size_t bits_word; -#define BITS_WORD_MAX SIZE_MAX +# define BITS_WORD_MAX SIZE_MAX enum { BITS_PER_BITS_WORD = CHAR_BIT * sizeof (bits_word) }; #else typedef unsigned char bits_word; -#define BITS_WORD_MAX ((1u << BOOL_VECTOR_BITS_PER_CHAR) - 1) +# define BITS_WORD_MAX ((1u << BOOL_VECTOR_BITS_PER_CHAR) - 1) enum { BITS_PER_BITS_WORD = BOOL_VECTOR_BITS_PER_CHAR }; #endif +verify (BITS_WORD_MAX >> (BITS_PER_BITS_WORD - 1) == 1); /* Number of bits in some machine integer types. */ enum @@ -1212,7 +1212,9 @@ struct vectorlike_header header; /* This is the size in bits. */ EMACS_INT size; - /* This contains the actual bits, packed into bytes. */ + /* The actual bits, packed into bytes. + The bits are in little-endian order in the bytes, and + the bytes are in little-endian order in the words. */ bits_word data[FLEXIBLE_ARRAY_MEMBER]; }; @@ -1236,7 +1238,7 @@ return (unsigned char *) bool_vector_data (a); } -/* The number of data words in a bool vector with SIZE bits. */ +/* The number of data words and bytes in a bool vector with SIZE bits. */ INLINE EMACS_INT bool_vector_words (EMACS_INT size) @@ -1245,6 +1247,13 @@ return (size + BITS_PER_BITS_WORD - 1) / BITS_PER_BITS_WORD; } +INLINE EMACS_INT +bool_vector_bytes (EMACS_INT size) +{ + eassume (0 <= size && size <= EMACS_INT_MAX - (BITS_PER_BITS_WORD - 1)); + return (size + BOOL_VECTOR_BITS_PER_CHAR - 1) / BOOL_VECTOR_BITS_PER_CHAR; +} + /* True if A's Ith bit is set. */ INLINE bool @@ -3588,7 +3597,8 @@ make_number (w), make_number (h)); } -extern void bool_vector_fill (Lisp_Object, Lisp_Object); +extern Lisp_Object make_uninit_bool_vector (EMACS_INT); +extern Lisp_Object bool_vector_fill (Lisp_Object, Lisp_Object); extern _Noreturn void string_overflow (void); extern Lisp_Object make_string (const char *, ptrdiff_t); extern Lisp_Object make_formatted_string (char *, const char *, ...) === modified file 'src/lread.c' --- src/lread.c 2013-11-05 07:11:24 +0000 +++ src/lread.c 2013-11-14 02:39:28 +0000 @@ -2577,9 +2577,7 @@ if (c == '"') { Lisp_Object tmp, val; - EMACS_INT size_in_chars - = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1) - / BOOL_VECTOR_BITS_PER_CHAR); + EMACS_INT size_in_chars = bool_vector_bytes (XFASTINT (length)); unsigned char *data; UNREAD (c); @@ -2594,7 +2592,7 @@ == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) invalid_syntax ("#&..."); - val = Fmake_bool_vector (length, Qnil); + val = make_uninit_bool_vector (XFASTINT (length)); data = bool_vector_uchar_data (val); memcpy (data, SDATA (tmp), size_in_chars); /* Clear the extraneous bits in the last byte. */ === modified file 'src/print.c' --- src/print.c 2013-11-05 07:11:24 +0000 +++ src/print.c 2013-11-14 02:39:28 +0000 @@ -1705,8 +1705,7 @@ unsigned char c; struct gcpro gcpro1; EMACS_INT size = bool_vector_size (obj); - ptrdiff_t size_in_chars = ((size + BOOL_VECTOR_BITS_PER_CHAR - 1) - / BOOL_VECTOR_BITS_PER_CHAR); + ptrdiff_t size_in_chars = bool_vector_bytes (size); ptrdiff_t real_size_in_chars = size_in_chars; GCPRO1 (obj); ------------------------------------------------------------ revno: 115094 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-11-13 17:52:18 -0800 message: Prefer tail calls. * lib-src/ebrowse.c (xstrdup): * lib-src/etags.c (savenstr): * lwlib/lwlib.c (safe_strdup): * src/xfns.c (xic_create_fontsetname): * src/xrdb.c (gethomedir): Prefer tail calls. * lib-src/etags.c (concat): Omit unnecessary assignment. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2013-10-24 23:04:33 +0000 +++ lib-src/ChangeLog 2013-11-14 01:52:18 +0000 @@ -1,3 +1,9 @@ +2013-11-14 Paul Eggert + + * ebrowse.c (xstrdup): + * etags.c (savenstr): Prefer tail calls. + * etags.c (concat): Omit unnecessary assignment. + 2013-10-24 Glenn Morris * Makefile.in ($(DESTDIR)${archlibdir}): === modified file 'lib-src/ebrowse.c' --- lib-src/ebrowse.c 2013-07-10 23:23:57 +0000 +++ lib-src/ebrowse.c 2013-11-14 01:52:18 +0000 @@ -514,7 +514,7 @@ xstrdup (char *s) { if (s) - s = strcpy (xmalloc (strlen (s) + 1), s); + return strcpy (xmalloc (strlen (s) + 1), s); return s; } === modified file 'lib-src/etags.c' --- lib-src/etags.c 2013-07-02 00:33:04 +0000 +++ lib-src/etags.c 2013-11-14 01:52:18 +0000 @@ -6243,12 +6243,9 @@ static char * savenstr (const char *cp, int len) { - register char *dp; - - dp = xnew (len + 1, char); - memcpy (dp, cp, len); + char *dp = xnew (len + 1, char); dp[len] = '\0'; - return dp; + return memcpy (dp, cp, len); } /* @@ -6362,7 +6359,6 @@ strcpy (result, s1); strcpy (result + len1, s2); strcpy (result + len1 + len2, s3); - result[len1 + len2 + len3] = '\0'; return result; } === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2013-11-02 19:41:33 +0000 +++ lwlib/ChangeLog 2013-11-14 01:52:18 +0000 @@ -1,3 +1,7 @@ +2013-11-14 Paul Eggert + + * lwlib.c (safe_strdup): Prefer tail calls. + 2013-11-02 Glenn Morris Use relative filenames in TAGS files. === modified file 'lwlib/lwlib.c' --- lwlib/lwlib.c 2013-01-01 09:11:05 +0000 +++ lwlib/lwlib.c 2013-11-14 01:52:18 +0000 @@ -103,11 +103,7 @@ char * safe_strdup (const char *s) { - char *result; - if (! s) return 0; - result = (char *) xmalloc (strlen (s) + 1); - strcpy (result, s); - return result; + return s ? xstrdup (s) : 0; } static void === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-12 06:07:37 +0000 +++ src/ChangeLog 2013-11-14 01:52:18 +0000 @@ -1,3 +1,8 @@ +2013-11-14 Paul Eggert + + * xfns.c (xic_create_fontsetname): + * xrdb.c (gethomedir): Prefer tail calls. + 2013-11-12 Paul Eggert * xterm.c (syms_of_xterm): staticpro Qmodifier_value, Qalt, Qhyper, === modified file 'src/xfns.c' --- src/xfns.c 2013-11-06 18:41:31 +0000 +++ src/xfns.c 2013-11-14 01:52:18 +0000 @@ -1750,7 +1750,7 @@ } } if (motif) - strcat (fontsetname, ":"); + return strcat (fontsetname, ":"); return fontsetname; } #endif /* HAVE_X_WINDOWS && USE_X_TOOLKIT */ === modified file 'src/xrdb.c' --- src/xrdb.c 2013-09-17 12:27:21 +0000 +++ src/xrdb.c 2013-11-14 01:52:18 +0000 @@ -234,9 +234,7 @@ copy = xmalloc (strlen (ptr) + 2); strcpy (copy, ptr); - strcat (copy, "/"); - - return copy; + return strcat (copy, "/"); } ------------------------------------------------------------ revno: 115093 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2013-11-13 19:41:58 -0500 message: * lisp/widget.el, lisp/hfy-cmap.el: Remove bogus package version number. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-13 20:48:35 +0000 +++ lisp/ChangeLog 2013-11-14 00:41:58 +0000 @@ -1,3 +1,7 @@ +2013-11-14 Stefan Monnier + + * widget.el, hfy-cmap.el: Remove bogus package version number. + 2013-11-13 Glenn Morris * replace.el (replace-eval-replacement): @@ -20,8 +24,8 @@ 2013-11-12 Dmitry Gutov * progmodes/ruby-mode.el (ruby-smie-grammar): Disambiguate between - binary "|" operator and closing block args delimiter. Remove - FIXME comment referring to Ruby 1.8-only syntax. + binary "|" operator and closing block args delimiter. + Remove FIXME comment referring to Ruby 1.8-only syntax. (ruby-smie--implicit-semi-p): Not after "|" operator. (ruby-smie--closing-pipe-p): New function. (ruby-smie--forward-token, ruby-smie--backward-token): Use it. === modified file 'lisp/hfy-cmap.el' --- lisp/hfy-cmap.el 2013-10-30 17:34:17 +0000 +++ lisp/hfy-cmap.el 2013-11-14 00:41:58 +0000 @@ -5,7 +5,6 @@ ;; Emacs Lisp Archive Entry ;; Package: htmlfontify ;; Filename: hfy-cmap.el -;; Version: 0.20 ;; Keywords: colour, rgb ;; Author: Vivek Dasmohapatra ;; Maintainer: Vivek Dasmohapatra === modified file 'lisp/widget.el' --- lisp/widget.el 2013-01-01 09:11:05 +0000 +++ lisp/widget.el 2013-11-14 00:41:58 +0000 @@ -4,7 +4,6 @@ ;; ;; Author: Per Abrahamsen ;; Keywords: help, extensions, faces, hypermedia -;; Version: 1.9920 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ ;; Package: emacs ------------------------------------------------------------ revno: 115092 author: Jan Tatarik committer: Katsumi Yamaoka branch nick: trunk timestamp: Wed 2013-11-13 22:16:42 +0000 message: lisp/gnus/gnus-icalendar.el: Fix for gnus-icalendar handling of empty appt locations; gnus-icalendar can update org entry for canceled appointments diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-11-12 22:16:09 +0000 +++ lisp/gnus/ChangeLog 2013-11-13 22:16:42 +0000 @@ -1,3 +1,17 @@ +2013-11-13 Jan Tatarik + + * gnus-icalendar.el (gnus-icalendar-event:sync-to-org) + (gnus-icalendar-event:inline-org-buttons): Allow for appointment + cancellations to be synced to org if the original appt has an org + outline. + +2013-11-13 Jan Tatarik + + * gnus-icalendar.el (gnus-icalendar--format-summary-line) + (gnus-icalendar-event->org-entry) + (gnus-icalendar--update-org-event) + (gnus-icalendar-event->gnus-calendar): Fix empty location handling. + 2013-11-12 Jan Tatarik * gnus-icalendar.el (gnus-icalendar-event-from-ical): === modified file 'lisp/gnus/gnus-icalendar.el' --- lisp/gnus/gnus-icalendar.el 2013-11-12 22:16:09 +0000 +++ lisp/gnus/gnus-icalendar.el 2013-11-13 22:16:42 +0000 @@ -361,6 +361,11 @@ (format "<%s %s-%s%s>" start-date start-time end-time repeat) (format "<%s %s>--<%s %s>" start-date start-time end-date end-time)))) +(defun gnus-icalendar--format-summary-line (summary &optional location) + (if location + (format "%s (%s)" summary location) + (format "%s" summary))) + ;; TODO: make the template customizable (defmethod gnus-icalendar-event->org-entry ((event gnus-icalendar-event) reply-status) "Return string with new `org-mode' entry describing EVENT." @@ -378,7 +383,8 @@ ("RRULE" . ,(gnus-icalendar-event:recur event)) ("REPLY" . ,reply)))) - (insert (format "* %s (%s)\n\n" summary location)) + (insert (format "* %s\n\n" + (gnus-icalendar--format-summary-line summary location))) (mapc (lambda (prop) (org-entry-put (point) (car prop) (cdr prop))) props)) @@ -443,7 +449,7 @@ (headline (delq nil (list (org-entry-get (point) "TODO") (when priority (format "[#%s]" priority)) - (format "%s (%s)" summary location) + (gnus-icalendar--format-summary-line summary location) (org-entry-get (point) "TAGS"))))) (re-search-forward "^\\*+ " (line-end-position)) @@ -540,7 +546,7 @@ (gnus-icalendar--update-org-event event reply-status) (gnus-icalendar:org-event-save event reply-status))) -(defmethod gnus-icalendar-event:sync-to-org ((event gnus-icalendar-event-cancel)) +(defmethod gnus-icalendar-event:sync-to-org ((event gnus-icalendar-event-cancel) reply-status) (when (gnus-icalendar-find-org-event-file event) (gnus-icalendar--cancel-org-event event))) @@ -591,7 +597,7 @@ (with-slots (organizer summary description location recur uid method rsvp) event (let ((headers `(("Summary" ,summary) - ("Location" ,location) + ("Location" ,(or location "")) ("Time" ,(gnus-icalendar-event:org-timestamp event)) ("Organizer" ,organizer) ("Method" ,method)))) @@ -717,6 +723,18 @@ (when org-entry-exists-p `("Show Org Entry" gnus-icalendar--show-org-event ,event)))))) + +(defmethod gnus-icalendar-event:inline-org-buttons ((event gnus-icalendar-event-cancel)) + (let ((org-entry-exists-p (gnus-icalendar-find-org-event-file event))) + + (delq nil (list + `("Show Agenda" gnus-icalendar-show-org-agenda ,event) + (when org-entry-exists-p + `("Update Org Entry" gnus-icalendar-sync-event-to-org ,event)) + (when org-entry-exists-p + `("Show Org Entry" gnus-icalendar--show-org-event ,event)))))) + + (defun gnus-icalendar-mm-inline (handle) (let ((event (gnus-icalendar-event-from-handle handle gnus-icalendar-identities))) ------------------------------------------------------------ revno: 115091 fixes bug: http://debbugs.gnu.org/15836 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-11-13 15:48:35 -0500 message: * lisp/replace.el (replace-eval-replacement): Try to give more helpful error message. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-13 20:40:12 +0000 +++ lisp/ChangeLog 2013-11-13 20:48:35 +0000 @@ -1,5 +1,8 @@ 2013-11-13 Glenn Morris + * replace.el (replace-eval-replacement): + Try to give more helpful error message. (Bug#15836) + * arc-mode.el (archive-7z-extract, archive-7z-expunge) (archive-7z-update): Avoid custom type mismatches. === modified file 'lisp/replace.el' --- lisp/replace.el 2013-10-13 05:30:23 +0000 +++ lisp/replace.el 2013-11-13 20:48:35 +0000 @@ -1,7 +1,7 @@ ;;; replace.el --- replace commands for Emacs -;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2013 Free -;; Software Foundation, Inc. +;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2013 +;; Free Software Foundation, Inc. ;; Maintainer: FSF ;; Package: emacs @@ -1793,7 +1793,12 @@ (defun replace-eval-replacement (expression count) (let* ((replace-count count) - (replacement (eval expression))) + err + (replacement + (condition-case err + (eval expression) + (error + (error "Error evaluating replacement expression: %S" err))))) (if (stringp replacement) replacement (prin1-to-string replacement t)))) ------------------------------------------------------------ revno: 115090 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-11-13 15:40:12 -0500 message: * lisp/arc-mode.el (archive-7z-extract, archive-7z-expunge) (archive-7z-update): Avoid custom type mismatches. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-13 20:06:37 +0000 +++ lisp/ChangeLog 2013-11-13 20:40:12 +0000 @@ -1,5 +1,8 @@ 2013-11-13 Glenn Morris + * arc-mode.el (archive-7z-extract, archive-7z-expunge) + (archive-7z-update): Avoid custom type mismatches. + * vc/vc.el (vc-diff-knows-L): Remove; unused since 2007-10-10. 2013-11-13 Michael Albinus === modified file 'lisp/arc-mode.el' --- lisp/arc-mode.el 2013-09-11 03:31:56 +0000 +++ lisp/arc-mode.el 2013-11-13 20:40:12 +0000 @@ -1,7 +1,6 @@ ;;; arc-mode.el --- simple editing of archives -;; Copyright (C) 1995, 1997-1998, 2001-2013 Free Software Foundation, -;; Inc. +;; Copyright (C) 1995, 1997-1998, 2001-2013 Free Software Foundation, Inc. ;; Author: Morten Welinder ;; Keywords: files archives msdog editing major-mode @@ -326,7 +325,7 @@ ;; 7z archive configuration (defcustom archive-7z-extract - `(,archive-7z-program "x" "-so") + `(,(or archive-7z-program "7z") "x" "-so") "Program and its options to run in order to extract a 7z file member. Extraction should happen to standard output. Archive and member name will be added." @@ -338,7 +337,7 @@ :group 'archive-7z) (defcustom archive-7z-expunge - `(,archive-7z-program "d") + `(,(or archive-7z-program "7z") "d") "Program and its options to run in order to delete 7z file members. Archive and member names will be added." :version "24.1" @@ -349,7 +348,7 @@ :group 'archive-7z) (defcustom archive-7z-update - `(,archive-7z-program "u") + `(,(or archive-7z-program "7z") "u") "Program and its options to run in order to update a 7z file member. Options should ensure that specified directory will be put into the 7z file. Archive and member name will be added." ------------------------------------------------------------ revno: 115089 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-11-13 15:06:37 -0500 message: * lisp/vc/vc.el (vc-diff-knows-L): Remove; unused since 2007-10-10. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-13 15:28:06 +0000 +++ lisp/ChangeLog 2013-11-13 20:06:37 +0000 @@ -1,3 +1,7 @@ +2013-11-13 Glenn Morris + + * vc/vc.el (vc-diff-knows-L): Remove; unused since 2007-10-10. + 2013-11-13 Michael Albinus * net/tramp.el (tramp-remote-file-name-spec-regexp): An IPV6 === modified file 'lisp/vc/vc.el' --- lisp/vc/vc.el 2013-10-25 02:33:42 +0000 +++ lisp/vc/vc.el 2013-11-13 20:06:37 +0000 @@ -755,13 +755,6 @@ :group 'vc :version "21.1") -(defcustom vc-diff-knows-L nil - "Indicates whether diff understands the -L option. -The value is either `yes', `no', or nil. If it is nil, VC tries -to use -L and sets this variable to remember whether it worked." - :type '(choice (const :tag "Work out" nil) (const yes) (const no)) - :group 'vc) - (defcustom vc-log-show-limit 2000 "Limit the number of items shown by the VC log commands. Zero means unlimited. ------------------------------------------------------------ revno: 115088 committer: Michael Albinus branch nick: trunk timestamp: Wed 2013-11-13 16:36:12 +0100 message: * automated/file-notify-tests.el (file-notify-test02-events) (file-notify-test03-autorevert): Suppress messages in `write-region'. * automated/tramp-tests.el (tramp-test02-file-name-dissect) (tramp-test03-file-name-defaults, tramp-test21-file-links): Add tests. (tramp-test26-process-file, tramp-test28-shell-command): Ensure, that the directory is not empty when calling "ls". diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2013-11-11 15:22:57 +0000 +++ test/ChangeLog 2013-11-13 15:36:12 +0000 @@ -1,3 +1,13 @@ +2013-11-13 Michael Albinus + + * automated/file-notify-tests.el (file-notify-test02-events) + (file-notify-test03-autorevert): Suppress messages in `write-region'. + + * automated/tramp-tests.el (tramp-test02-file-name-dissect) + (tramp-test03-file-name-defaults, tramp-test21-file-links): Add tests. + (tramp-test26-process-file, tramp-test28-shell-command): Ensure, + that the directory is not empty when calling "ls". + 2013-11-11 Michael Albinus * automated/tramp-tests.el (tramp-test-temporary-file-directory): === modified file 'test/automated/file-notify-tests.el' --- test/automated/file-notify-tests.el 2013-11-08 09:31:15 +0000 +++ test/automated/file-notify-tests.el 2013-11-13 15:36:12 +0000 @@ -189,16 +189,19 @@ '(change) 'file-notify--test-event-handler)) ;; Check creation and removal. - (write-region "any text" nil file-notify--test-tmpfile) + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) (delete-file file-notify--test-tmpfile) ;; Check copy and rename. - (write-region "any text" nil file-notify--test-tmpfile) + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) (delete-file file-notify--test-tmpfile) (delete-file file-notify--test-tmpfile1) - (write-region "any text" nil file-notify--test-tmpfile) + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) (delete-file file-notify--test-tmpfile1)) @@ -234,7 +237,8 @@ (progn (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) - (write-region "any text" nil file-notify--test-tmpfile) + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) (setq buf (find-file-noselect file-notify--test-tmpfile)) (with-current-buffer buf (should (string-equal (buffer-string) "any text")) === modified file 'test/automated/tramp-tests.el' --- test/automated/tramp-tests.el 2013-11-11 15:22:57 +0000 +++ test/automated/tramp-tests.el 2013-11-13 15:36:12 +0000 @@ -319,8 +319,26 @@ (should (string-equal (file-remote-p "/method:user@1.2.3.4:" 'localname) "")) - ;; This does not work. Why? - ;(should (file-remote-p "/[]:")) + ;; Expand `tramp-default-method', `tramp-default-user' and + ;; `tramp-default-host'. + (should (string-equal + (file-remote-p "/[]:") + (format + "/%s:%s@%s:" "default-method" "default-user" "default-host"))) + (should (string-equal (file-remote-p "/[]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/[]:" 'user) "default-user")) + (should (string-equal (file-remote-p "/[]:" 'host) "default-host")) + (should (string-equal (file-remote-p "/[]:" 'localname) "")) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (let ((tramp-default-host "::1")) + (should (string-equal + (file-remote-p "/[]:") + (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) + (should (string-equal (file-remote-p "/[]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/[]:" 'user) "default-user")) + (should (string-equal (file-remote-p "/[]:" 'host) "::1")) + (should (string-equal (file-remote-p "/[]:" 'localname) ""))) ;; Expand `tramp-default-method' and `tramp-default-user'. (should (string-equal @@ -436,19 +454,21 @@ (dolist (u '("ftp" "anonymous")) (should (string-equal (file-remote-p (format "/%s@:" u) 'method) "ftp"))) ;; Default values in tramp-gvfs.el. - ;(should (string-equal (file-remote-p "/synce::" 'user) nil)) + (when (and (load "tramp-gvfs" 'noerror 'nomessage) + (symbol-value 'tramp-gvfs-enabled)) + (should (string-equal (file-remote-p "/synce::" 'user) nil))) ;; Default values in tramp-gw.el. (dolist (m '("tunnel" "socks")) - (should (string-equal (file-remote-p (format "/%s::" m) 'user) - (user-login-name)))) + (should + (string-equal (file-remote-p (format "/%s::" m) 'user) (user-login-name)))) ;; Default values in tramp-sh.el. (dolist (h `("127.0.0.1" "[::1]" "localhost" "localhost6" ,(system-name))) (should (string-equal (file-remote-p (format "/root@%s:" h) 'method) "su"))) (dolist (m '("su" "sudo" "ksu")) (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root"))) (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp")) - (should (string-equal (file-remote-p (format "/%s::" m) 'user) - (user-login-name)))) + (should + (string-equal (file-remote-p (format "/%s::" m) 'user) (user-login-name)))) ;; Default values in tramp-smb.el. (should (string-equal (file-remote-p "/user%domain@host:" 'method) "smb")) (should (string-equal (file-remote-p "/smb::" 'user) nil))) @@ -456,65 +476,75 @@ (ert-deftest tramp-test04-substitute-in-file-name () "Check `substitute-in-file-name'." (should (string-equal (substitute-in-file-name "/method:host://foo") "/foo")) - (should (string-equal - (substitute-in-file-name "/method:host:/path//foo") - "/method:host:/foo")) - (should (string-equal - (substitute-in-file-name "/method:host:/path///foo") "/foo")) - (should (string-equal - (substitute-in-file-name "/method:host:/path/~/foo") - "/method:host:~/foo")) - (should (string-equal - (substitute-in-file-name "/method:host:/path//~/foo") "~/foo")) + (should + (string-equal + (substitute-in-file-name "/method:host:/path//foo") "/method:host:/foo")) + (should + (string-equal (substitute-in-file-name "/method:host:/path///foo") "/foo")) + (should + (string-equal + (substitute-in-file-name "/method:host:/path/~/foo") "/method:host:~/foo")) + (should + (string-equal (substitute-in-file-name "/method:host:/path//~/foo") "~/foo")) (let (process-environment) (should - (string-equal (substitute-in-file-name "/method:host:/path/$FOO") - "/method:host:/path/$FOO")) + (string-equal + (substitute-in-file-name "/method:host:/path/$FOO") + "/method:host:/path/$FOO")) (setenv "FOO" "bla") - (should (string-equal - (substitute-in-file-name "/method:host:/path/$FOO") - "/method:host:/path/bla")) - (should (string-equal - (substitute-in-file-name "/method:host:/path/$$FOO") - "/method:host:/path/$FOO")))) + (should + (string-equal + (substitute-in-file-name "/method:host:/path/$FOO") + "/method:host:/path/bla")) + (should + (string-equal + (substitute-in-file-name "/method:host:/path/$$FOO") + "/method:host:/path/$FOO")))) (ert-deftest tramp-test05-expand-file-name () "Check `expand-file-name'." - (should (string-equal - (expand-file-name "/method:host:/path/./file") - "/method:host:/path/file")) - (should (string-equal - (expand-file-name "/method:host:/path/../file") - "/method:host:/file"))) + (should + (string-equal + (expand-file-name "/method:host:/path/./file") "/method:host:/path/file")) + (should + (string-equal + (expand-file-name "/method:host:/path/../file") "/method:host:/file"))) (ert-deftest tramp-test06-directory-file-name () "Check `directory-file-name'. This checks also `file-name-as-directory', `file-name-directory' and `file-name-nondirectory'." - (should (string-equal - (directory-file-name "/method:host:/path/to/file") - "/method:host:/path/to/file")) - (should (string-equal - (directory-file-name "/method:host:/path/to/file/") - "/method:host:/path/to/file")) - (should (string-equal - (file-name-as-directory "/method:host:/path/to/file") - "/method:host:/path/to/file/")) - (should (string-equal - (file-name-as-directory "/method:host:/path/to/file/") - "/method:host:/path/to/file/")) - (should (string-equal - (file-name-directory "/method:host:/path/to/file") - "/method:host:/path/to/")) - (should (string-equal - (file-name-directory "/method:host:/path/to/file/") - "/method:host:/path/to/file/")) - (should (string-equal - (file-name-nondirectory "/method:host:/path/to/file") "file")) - (should (string-equal - (file-name-nondirectory "/method:host:/path/to/file/") "")) - (should-not (file-remote-p - (unhandled-file-name-directory "/method:host:/path/to/file")))) + (should + (string-equal + (directory-file-name "/method:host:/path/to/file") + "/method:host:/path/to/file")) + (should + (string-equal + (directory-file-name "/method:host:/path/to/file/") + "/method:host:/path/to/file")) + (should + (string-equal + (file-name-as-directory "/method:host:/path/to/file") + "/method:host:/path/to/file/")) + (should + (string-equal + (file-name-as-directory "/method:host:/path/to/file/") + "/method:host:/path/to/file/")) + (should + (string-equal + (file-name-directory "/method:host:/path/to/file") + "/method:host:/path/to/")) + (should + (string-equal + (file-name-directory "/method:host:/path/to/file/") + "/method:host:/path/to/file/")) + (should + (string-equal (file-name-nondirectory "/method:host:/path/to/file") "file")) + (should + (string-equal (file-name-nondirectory "/method:host:/path/to/file/") "")) + (should-not + (file-remote-p + (unhandled-file-name-directory "/method:host:/path/to/file")))) (ert-deftest tramp-test07-file-exists-p () "Check `file-exist-p', `write-region' and `delete-file'." @@ -872,7 +902,9 @@ (should (file-exists-p tmp-name1)) (make-symbolic-link tmp-name1 tmp-name2) (should (file-symlink-p tmp-name2)) - (should (string-equal (file-truename tmp-name2) tmp-name1))) + (should-not (string-equal tmp-name2 (file-truename tmp-name2))) + (should + (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))) (delete-file tmp-name1) (delete-file tmp-name2)))) @@ -955,15 +987,20 @@ (ert-deftest tramp-test26-process-file () "Check `process-file'." (skip-unless (tramp--test-enabled)) - (let ((default-directory tramp-test-temporary-file-directory)) - ;; We cannot use "/bin/true" and "/bin/false"; those paths do not - ;; exist on hydra. - (should (zerop (process-file "true"))) - (should-not (zerop (process-file "false"))) - (should-not (zerop (process-file "binary-does-not-exist"))) - (with-temp-buffer - (should (zerop (process-file "ls" nil t))) - (should (> (point-max) (point-min)))))) + (let ((tmp-name (tramp--test-make-temp-name)) + (default-directory tramp-test-temporary-file-directory)) + (unwind-protect + (progn + ;; We cannot use "/bin/true" and "/bin/false"; those paths + ;; do not exist on hydra. + (should (zerop (process-file "true"))) + (should-not (zerop (process-file "false"))) + (should-not (zerop (process-file "binary-does-not-exist"))) + (with-temp-buffer + (write-region "foo" nil tmp-name) + (should (zerop (process-file "ls" nil t))) + (should (> (point-max) (point-min))))) + (delete-file tmp-name)))) (ert-deftest tramp-test27-start-file-process () "Check `start-file-process'." @@ -1011,10 +1048,14 @@ (ert-deftest tramp-test28-shell-command () "Check `shell-command'." (skip-unless (tramp--test-enabled)) - (let ((default-directory tramp-test-temporary-file-directory)) - (with-temp-buffer - (shell-command "ls" (current-buffer)) - (should (> (point-max) (point-min)))))) + (let ((tmp-name (tramp--test-make-temp-name)) + (default-directory tramp-test-temporary-file-directory)) + (unwind-protect + (with-temp-buffer + (write-region "foo" nil tmp-name) + (shell-command "ls" (current-buffer)) + (should (> (point-max) (point-min)))) + (delete-file tmp-name)))) ;; TODO: ------------------------------------------------------------ revno: 115087 committer: Michael Albinus branch nick: trunk timestamp: Wed 2013-11-13 16:28:06 +0100 message: * net/tramp.el (tramp-remote-file-name-spec-regexp): An IPV6 address can be empty. * net/tramp-gvfs.el (tramp-gvfs-handle-insert-directory): Accept nil SWITCHES. (tramp-gvfs-handle-write-region): Implement APPEND. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-12 14:15:14 +0000 +++ lisp/ChangeLog 2013-11-13 15:28:06 +0000 @@ -1,3 +1,12 @@ +2013-11-13 Michael Albinus + + * net/tramp.el (tramp-remote-file-name-spec-regexp): An IPV6 + address can be empty. + + * net/tramp-gvfs.el (tramp-gvfs-handle-insert-directory): + Accept nil SWITCHES. + (tramp-gvfs-handle-write-region): Implement APPEND. + 2013-11-12 Dmitry Gutov * progmodes/ruby-mode.el (ruby-smie-grammar): Disambiguate between === modified file 'lisp/net/tramp-gvfs.el' --- lisp/net/tramp-gvfs.el 2013-10-17 19:39:22 +0000 +++ lisp/net/tramp-gvfs.el 2013-11-13 15:28:06 +0000 @@ -1009,6 +1009,7 @@ (filename switches &optional wildcard full-directory-p) "Like `insert-directory' for Tramp files." ;; gvfs-* output is hard to parse. So we let `ls-lisp' do the job. + (unless switches (setq switches "")) (with-parsed-tramp-file-name (expand-file-name filename) nil (with-tramp-progress-reporter v 0 (format "Opening directory %s" filename) (require 'ls-lisp) @@ -1075,7 +1076,7 @@ (tramp-flush-file-property v localname)))))) (defun tramp-gvfs-handle-write-region - (start end filename &optional _append visit _lockname confirm) + (start end filename &optional append visit lockname confirm) "Like `write-region' for Tramp files." (with-parsed-tramp-file-name filename nil ;; XEmacs takes a coding system as the seventh argument, not `confirm'. @@ -1084,7 +1085,16 @@ (tramp-error v 'file-error "File not overwritten"))) (let ((tmpfile (tramp-compat-make-temp-file filename))) - (write-region start end tmpfile) + (when (and append (file-exists-p filename)) + (copy-file filename tmpfile 'ok)) + ;; We say `no-message' here because we don't want the visited file + ;; modtime data to be clobbered from the temp file. We call + ;; `set-visited-file-modtime' ourselves later on. + (tramp-run-real-handler + 'write-region + (if confirm ; don't pass this arg unless defined for backward compat. + (list start end tmpfile append 'no-message lockname confirm) + (list start end tmpfile append 'no-message lockname))) (condition-case nil (rename-file tmpfile filename 'ok-if-already-exists) (error === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2013-11-10 08:35:04 +0000 +++ lisp/net/tramp.el 2013-11-13 15:28:06 +0000 @@ -848,7 +848,7 @@ "\\(?:" "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp "\\)?" "\\(?:" "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp "\\)?" "\\(" "\\(?:" tramp-host-regexp "\\|" - tramp-prefix-ipv6-regexp tramp-ipv6-regexp + tramp-prefix-ipv6-regexp "\\(?:" tramp-ipv6-regexp "\\)?" tramp-postfix-ipv6-regexp "\\)" "\\(?:" tramp-prefix-port-regexp tramp-port-regexp "\\)?" "\\)?") "Regular expression matching a Tramp file name between prefix and postfix.") ------------------------------------------------------------ revno: 115086 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-11-13 00:04:57 -0800 message: * Makefile.in (ACLOCAL_INPUTS): Add configure.ac. diff: === modified file 'ChangeLog' --- ChangeLog 2013-11-12 02:50:28 +0000 +++ ChangeLog 2013-11-13 08:04:57 +0000 @@ -1,3 +1,7 @@ +2013-11-13 Paul Eggert + + * Makefile.in (ACLOCAL_INPUTS): Add configure.ac. + 2013-11-12 Dani Moncayo * configure.ac [MINGW32]: Source nt/mingw-cfg.site. === modified file 'Makefile.in' --- Makefile.in 2013-11-12 02:40:14 +0000 +++ Makefile.in 2013-11-13 08:04:57 +0000 @@ -435,7 +435,7 @@ $(srcdir)/configure: $(AUTOCONF_INPUTS) cd ${srcdir} && autoconf -ACLOCAL_INPUTS = $(srcdir)/m4/gnulib-comp.m4 +ACLOCAL_INPUTS = $(srcdir)/configure.ac $(srcdir)/m4/gnulib-comp.m4 $(srcdir)/aclocal.m4: $(ACLOCAL_INPUTS) cd $(srcdir) && aclocal -I m4