------------------------------------------------------------ revno: 114707 committer: Glenn Morris branch nick: trunk timestamp: Fri 2013-10-18 00:56:45 -0700 message: * lisp/progmodes/verilog-mode.el (verilog-case-fold): Add :version. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-18 07:46:36 +0000 +++ lisp/ChangeLog 2013-10-18 07:56:45 +0000 @@ -1,3 +1,7 @@ +2013-10-18 Glenn Morris + + * progmodes/verilog-mode.el (verilog-case-fold): Add :version. + 2013-10-18 Wilson Snyder Sync with upstream verilog-mode revision 1a6ecec7. === modified file 'lisp/progmodes/verilog-mode.el' --- lisp/progmodes/verilog-mode.el 2013-10-18 07:46:36 +0000 +++ lisp/progmodes/verilog-mode.el 2013-10-18 07:56:45 +0000 @@ -1187,6 +1187,7 @@ (defcustom verilog-case-fold t "Non-nil means `verilog-mode' regexps should ignore case. This variable is t for backward compatibility; nil is suggested." + :version "24.4" :group 'verilog-mode :type 'boolean) (put 'verilog-case-fold 'safe-local-variable 'verilog-booleanp) ------------------------------------------------------------ revno: 114706 author: Wilson Snyder committer: Glenn Morris branch nick: trunk timestamp: Fri 2013-10-18 00:46:36 -0700 message: Sync with upstream verilog-mode revision 1a6ecec7 * progmodes/verilog-mode.el (verilog-mode-version): Update. (verilog-mode-release-date): Remove. (verilog-highlight-grouping-keywords, verilog-active-low-regexp) (verilog-auto-inst-param-value, verilog-auto-input-ignore-regexp) (verilog-auto-inout-ignore-regexp, verilog-auto-output-ignore-regexp) (verilog-auto-tieoff-ignore-regexp) (verilog-auto-unused-ignore-regexp, verilog-typedef-regexp) (verilog-scan-cache-preserving, verilog-mode, verilog-at-struct-p) (verilog-signals-with, verilog-dir-cache-preserving) (verilog-auto-inst, verilog-auto-inout-param, verilog-auto): Doc fixes. (verilog-case-fold): New option, to control case folding in regexp searches, bug597. (verilog-menu): Add verilog-sk-uvm-component, minor tweaks. (verilog-string-match-fold, verilog-in-paren-count) (verilog-in-struct-nested-p, verilog-at-struct-mv-p) (verilog-at-close-struct-p): New functions. (verilog-beg-block-re-ordered, verilog-extended-case-re) (verilog-forward-sexp, verilog-set-auto-endcomments): (verilog-leap-to-case-head): Handle "unique0" case. (verilog-in-constraint-re): New constant. (verilog-keywords, verilog-type-font-keywords): Add some SystemVerilog 1800-2012 keywords. (verilog-label-be): Remove unimplemented argument, bug669. (verilog-batch-execute-func): When batch expanding clear create-lockfiles to prevent spurious user locks when a file ends up not changing. (verilog-calculate-indent, verilog-calc-1) (verilog-at-close-constraint-p, verilog-at-constraint-p) (verilog-do-indent): Fix indentation of nested constraints and structures. (verilog-sig-tieoff, verilog-typedef-name-p, verilog-auto-inst) (verilog-auto-inst-param): Use verilog-string-match-fold. (verilog-read-inst-module-matcher): Fix AUTOINST on gate primitives with #1. (verilog-read-decls): Fix double-declaring user-defined typed signals. Reads all user-defined typed variables. (verilog-read-defines): Fix reading definitions inside comments, bug647. (verilog-signals-matching-regexp) (verilog-signals-not-matching-regexp, verilog-auto): Respect verilog-case-fold. (verilog-diff-report): Fix line count. (verilog-auto-assign-modport): Remove unused local `modi'. (verilog-auto-inst-port): Support [][] in AUTO_TEMPLATE to better handle multidimensional arrays. Fix packed array ports misadding bit index in AUTOINST, bug637. (verilog-auto-output, verilog-auto-input): Fix AUTOINPUT and AUTOOUTPUT to not double-declare existing outputs and inputs, respectively. (verilog-template-map): Bind U to verilog-sk-uvm-component. (verilog-sk-uvm-object): Rename from verilog-sk-uvm-class. (verilog-sk-uvm-component): New skeleton. (verilog-submit-bug-report): Add verilog-case-fold, remove verilog-mode-release-date. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-18 04:27:34 +0000 +++ lisp/ChangeLog 2013-10-18 07:46:36 +0000 @@ -1,3 +1,60 @@ +2013-10-18 Wilson Snyder + + Sync with upstream verilog-mode revision 1a6ecec7. + * progmodes/verilog-mode.el (verilog-mode-version): Update. + (verilog-mode-release-date): Remove. + (verilog-highlight-grouping-keywords, verilog-active-low-regexp) + (verilog-auto-inst-param-value, verilog-auto-input-ignore-regexp) + (verilog-auto-inout-ignore-regexp, verilog-auto-output-ignore-regexp) + (verilog-auto-tieoff-ignore-regexp) + (verilog-auto-unused-ignore-regexp, verilog-typedef-regexp) + (verilog-scan-cache-preserving, verilog-mode, verilog-at-struct-p) + (verilog-signals-with, verilog-dir-cache-preserving) + (verilog-auto-inst, verilog-auto-inout-param, verilog-auto): + Doc fixes. + (verilog-case-fold): New option, to control case folding in + regexp searches, bug597. + (verilog-menu): Add verilog-sk-uvm-component, minor tweaks. + (verilog-string-match-fold, verilog-in-paren-count) + (verilog-in-struct-nested-p, verilog-at-struct-mv-p) + (verilog-at-close-struct-p): New functions. + (verilog-beg-block-re-ordered, verilog-extended-case-re) + (verilog-forward-sexp, verilog-set-auto-endcomments): + (verilog-leap-to-case-head): Handle "unique0" case. + (verilog-in-constraint-re): New constant. + (verilog-keywords, verilog-type-font-keywords): + Add some SystemVerilog 1800-2012 keywords. + (verilog-label-be): Remove unimplemented argument, bug669. + (verilog-batch-execute-func): When batch expanding clear + create-lockfiles to prevent spurious user locks when a file ends + up not changing. + (verilog-calculate-indent, verilog-calc-1) + (verilog-at-close-constraint-p, verilog-at-constraint-p) + (verilog-do-indent): Fix indentation of nested constraints + and structures. + (verilog-sig-tieoff, verilog-typedef-name-p, verilog-auto-inst) + (verilog-auto-inst-param): Use verilog-string-match-fold. + (verilog-read-inst-module-matcher): + Fix AUTOINST on gate primitives with #1. + (verilog-read-decls): Fix double-declaring user-defined typed signals. + Reads all user-defined typed variables. + (verilog-read-defines): Fix reading definitions inside comments, bug647. + (verilog-signals-matching-regexp) + (verilog-signals-not-matching-regexp, verilog-auto): + Respect verilog-case-fold. + (verilog-diff-report): Fix line count. + (verilog-auto-assign-modport): Remove unused local `modi'. + (verilog-auto-inst-port): Support [][] in AUTO_TEMPLATE to + better handle multidimensional arrays. + Fix packed array ports misadding bit index in AUTOINST, bug637. + (verilog-auto-output, verilog-auto-input): Fix AUTOINPUT and AUTOOUTPUT + to not double-declare existing outputs and inputs, respectively. + (verilog-template-map): Bind U to verilog-sk-uvm-component. + (verilog-sk-uvm-object): Rename from verilog-sk-uvm-class. + (verilog-sk-uvm-component): New skeleton. + (verilog-submit-bug-report): Add verilog-case-fold, + remove verilog-mode-release-date. + 2013-10-17 Barry O'Reilly * lisp/subr.el (sit-for): Call (input-pending-p t) so as to behave === modified file 'lisp/progmodes/verilog-mode.el' --- lisp/progmodes/verilog-mode.el 2013-08-05 14:26:57 +0000 +++ lisp/progmodes/verilog-mode.el 2013-10-18 07:46:36 +0000 @@ -1,13 +1,12 @@ -;; verilog-mode.el --- major mode for editing verilog source in Emacs +;;; verilog-mode.el --- major mode for editing verilog source in Emacs ;; Copyright (C) 1996-2013 Free Software Foundation, Inc. -;; Author: Michael McNamara (mac@verilog.com), -;; Wilson Snyder (wsnyder@wsnyder.org) -;; Please see our web sites: +;; Author: Michael McNamara +;; Wilson Snyder ;; http://www.verilog.com ;; http://www.veripool.org -;; +;; Created: 3 Jan 1996 ;; Keywords: languages ;; Yoni Rabkin contacted the maintainer of this @@ -38,25 +37,26 @@ ;;; Commentary: -;; This mode borrows heavily from the Pascal-mode and the cc-mode of Emacs - ;; USAGE ;; ===== -;; A major mode for editing Verilog HDL source code. When you have -;; entered Verilog mode, you may get more info by pressing C-h m. You -;; may also get online help describing various functions by: C-h f -;; +;; A major mode for editing Verilog and SystemVerilog HDL source code (IEEE +;; 1364-2005 and IEEE 1800-2012 standards). When you have entered Verilog +;; mode, you may get more info by pressing C-h m. You may also get online +;; help describing various functions by: C-h f ;; KNOWN BUGS / BUG REPORTS ;; ======================= -;; Verilog is a rapidly evolving language, and hence this mode is -;; under continuous development. Hence this is beta code, and likely -;; has bugs. Please report any issues to the issue tracker at -;; http://www.veripool.org/verilog-mode +;; SystemVerilog is a rapidly evolving language, and hence this mode is +;; under continuous development. Please report any issues to the issue +;; tracker at +;; +;; http://www.veripool.org/verilog-mode +;; ;; Please use verilog-submit-bug-report to submit a report; type C-c -;; C-b to invoke this and as a result I will have a much easier time +;; C-b to invoke this and as a result we will have a much easier time ;; of reproducing the bug you find, and hence fixing it. ;; INSTALLING THE MODE @@ -110,8 +110,8 @@ ; verilog-indent-begin-after-if t ; verilog-auto-lineup 'declarations ; verilog-highlight-p1800-keywords nil -; verilog-linter "my_lint_shell_command" -; ) +; verilog-linter "my_lint_shell_command" +; ) ;; @@ -123,10 +123,8 @@ ;;; Code: ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version (substring "$$Revision: 840 $$" 12 -3) +(defconst verilog-mode-version "2013-10-09-1a6ecec-vpo" "Version of this Verilog mode.") -(defconst verilog-mode-release-date (substring "$$Date: 2013-01-03 05:29:05 -0800 (Thu, 03 Jan 2013) $$" 8 -3) - "Release date of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -504,11 +502,11 @@ If 'declarations', then just declarations are lined up with any preceding declarations, taking into account widths and the like, so or example the code: - reg [31:0] a; - reg b; + reg [31:0] a; + reg b; would become - reg [31:0] a; - reg b; + reg [31:0] a; + reg b; If 'assignment', then assignments are lined up with any preceding assignments, so for example the code @@ -663,7 +661,7 @@ (put 'verilog-highlight-p1800-keywords 'safe-local-variable 'verilog-booleanp) (defcustom verilog-highlight-grouping-keywords nil - "Non-nil means highlight grouping keywords 'begin' and 'end' more dramatically. + "Non-nil means highlight grouping keywords more dramatically. If false, these words are in the `font-lock-type-face'; if True then they are in `verilog-font-lock-ams-face'. Some find that special highlighting on these grouping constructs allow the structure of the code to be understood at a glance." @@ -960,7 +958,7 @@ (put 'verilog-library-extensions 'safe-local-variable 'listp) (defcustom verilog-active-low-regexp nil - "If set, treat signals matching this regexp as active low. + "If true, treat signals matching this regexp as active low. This is used for AUTORESET and AUTOTIEOFF. For proper behavior, you will probably also need `verilog-auto-reset-widths' set." :group 'verilog-mode-auto @@ -1003,7 +1001,7 @@ "True means AUTORESET should determine the width of signals. This is then used to set the width of the zero (32'h0 for example). This is required by some lint tools that aren't smart enough to ignore widths of -the constant zero. This may result in ugly code when parameters determine +the constant zero. This may result in ugly code when parameters determine the MSB or LSB of a signal inside an AUTORESET. If nil, AUTORESET uses \"0\" as the constant. @@ -1062,7 +1060,7 @@ module ExampInst; InstModule - #(PARAM(10)) + #(.PARAM(10)) instName (/*AUTOINST*/ .i (i[PARAM-1:0])); @@ -1073,7 +1071,7 @@ module ExampInst; InstModule - #(PARAM(10)) + #(.PARAM(10)) instName (/*AUTOINST*/ .i (i[9:0]));" @@ -1135,21 +1133,21 @@ (put 'verilog-auto-inst-interfaced-ports 'safe-local-variable 'verilog-booleanp) (defcustom verilog-auto-input-ignore-regexp nil - "If set, when creating AUTOINPUT list, ignore signals matching this regexp. + "If non-nil, when creating AUTOINPUT, ignore signals matching this regexp. See the \\[verilog-faq] for examples on using this." :group 'verilog-mode-auto :type '(choice (const nil) regexp)) (put 'verilog-auto-input-ignore-regexp 'safe-local-variable 'stringp) (defcustom verilog-auto-inout-ignore-regexp nil - "If set, when creating AUTOINOUT list, ignore signals matching this regexp. + "If non-nil, when creating AUTOINOUT, ignore signals matching this regexp. See the \\[verilog-faq] for examples on using this." :group 'verilog-mode-auto :type '(choice (const nil) regexp)) (put 'verilog-auto-inout-ignore-regexp 'safe-local-variable 'stringp) (defcustom verilog-auto-output-ignore-regexp nil - "If set, when creating AUTOOUTPUT list, ignore signals matching this regexp. + "If non-nil, when creating AUTOOUTPUT, ignore signals matching this regexp. See the \\[verilog-faq] for examples on using this." :group 'verilog-mode-auto :type '(choice (const nil) regexp)) @@ -1173,22 +1171,30 @@ (put 'verilog-auto-tieoff-declaration 'safe-local-variable 'stringp) (defcustom verilog-auto-tieoff-ignore-regexp nil - "If set, when creating AUTOTIEOFF list, ignore signals matching this regexp. + "If non-nil, when creating AUTOTIEOFF, ignore signals matching this regexp. See the \\[verilog-faq] for examples on using this." :group 'verilog-mode-auto :type '(choice (const nil) regexp)) (put 'verilog-auto-tieoff-ignore-regexp 'safe-local-variable 'stringp) (defcustom verilog-auto-unused-ignore-regexp nil - "If set, when creating AUTOUNUSED list, ignore signals matching this regexp. + "If non-nil, when creating AUTOUNUSED, ignore signals matching this regexp. See the \\[verilog-faq] for examples on using this." :group 'verilog-mode-auto :type '(choice (const nil) regexp)) (put 'verilog-auto-unused-ignore-regexp 'safe-local-variable 'stringp) +(defcustom verilog-case-fold t + "Non-nil means `verilog-mode' regexps should ignore case. +This variable is t for backward compatibility; nil is suggested." + :group 'verilog-mode + :type 'boolean) +(put 'verilog-case-fold 'safe-local-variable 'verilog-booleanp) + (defcustom verilog-typedef-regexp nil "If non-nil, regular expression that matches Verilog-2001 typedef names. -For example, \"_t$\" matches typedefs named with _t, as in the C language." +For example, \"_t$\" matches typedefs named with _t, as in the C language. +See also `verilog-case-fold'." :group 'verilog-mode-auto :type '(choice (const nil) regexp)) (put 'verilog-typedef-regexp 'safe-local-variable 'stringp) @@ -1437,6 +1443,8 @@ :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"] ["AUTOASSIGNMODPORT" (describe-function 'verilog-auto-assign-modport) :help "Help on AUTOASSIGNMODPORT - creating assignments to/from modports"] + ["AUTOINOUT" (describe-function 'verilog-auto-inout) + :help "Help on AUTOINOUT - adding inouts from cells"] ["AUTOINOUTCOMP" (describe-function 'verilog-auto-inout-comp) :help "Help on AUTOINOUTCOMP - copying complemented i/o from another file"] ["AUTOINOUTIN" (describe-function 'verilog-auto-inout-in) @@ -1447,12 +1455,10 @@ :help "Help on AUTOINOUTMODULE - copying i/o from another file"] ["AUTOINOUTPARAM" (describe-function 'verilog-auto-inout-param) :help "Help on AUTOINOUTPARAM - copying parameters from another file"] + ["AUTOINPUT" (describe-function 'verilog-auto-input) + :help "Help on AUTOINPUT - adding inputs from cells"] ["AUTOINSERTLISP" (describe-function 'verilog-auto-insert-lisp) :help "Help on AUTOINSERTLISP - insert text from a lisp function"] - ["AUTOINOUT" (describe-function 'verilog-auto-inout) - :help "Help on AUTOINOUT - adding inouts from cells"] - ["AUTOINPUT" (describe-function 'verilog-auto-input) - :help "Help on AUTOINPUT - adding inputs from cells"] ["AUTOINST" (describe-function 'verilog-auto-inst) :help "Help on AUTOINST - adding pins for cells"] ["AUTOINST (.*)" (describe-function 'verilog-auto-star) @@ -1471,7 +1477,7 @@ :help "Help on AUTOREGINPUT - declaring inputs for non-wires"] ["AUTORESET" (describe-function 'verilog-auto-reset) :help "Help on AUTORESET - resetting always blocks"] - ["AUTOSENSE" (describe-function 'verilog-auto-sense) + ["AUTOSENSE or AS" (describe-function 'verilog-auto-sense) :help "Help on AUTOSENSE - sensitivity lists for always blocks"] ["AUTOTIEOFF" (describe-function 'verilog-auto-tieoff) :help "Help on AUTOTIEOFF - tying off unused outputs"] @@ -1505,8 +1511,10 @@ :help "Insert a module .. (/*AUTOARG*/);.. endmodule block"] ["OVM Class" verilog-sk-ovm-class :help "Insert an OVM class block"] - ["UVM Class" verilog-sk-uvm-class - :help "Insert an UVM class block"] + ["UVM Object" verilog-sk-uvm-object + :help "Insert an UVM object block"] + ["UVM Component" verilog-sk-uvm-component + :help "Insert an UVM component block"] ["Primitive" verilog-sk-primitive :help "Insert a primitive .. (.. );.. endprimitive block"] "----" @@ -1594,6 +1602,14 @@ (defsubst verilog-within-string () (nth 3 (parse-partial-sexp (point-at-bol) (point)))) +(defsubst verilog-string-match-fold (regexp string &optional start) + "Like `string-match', but use `verilog-case-fold'. +Return index of start of first match for REGEXP in STRING, or nil. +Matching ignores case if `verilog-case-fold' is non-nil. +If third arg START is non-nil, start search at that index in STRING." + (let ((case-fold-search verilog-case-fold)) + (string-match regexp string start))) + (defsubst verilog-string-replace-matches (from-string to-string fixedcase literal string) "Replace occurrences of FROM-STRING with TO-STRING. FIXEDCASE and LITERAL as in `replace-match`. STRING is what to replace. @@ -2438,7 +2454,7 @@ ;; verilog-forward-sexp and verilog-calc-indent (defconst verilog-beg-block-re-ordered ( concat "\\(\\\\)" ;1 - "\\|\\(\\\\|\\(\\\\)" ; 2,3 + "\\|\\(\\\\|\\(\\\\)" ; 2,3 "\\|\\(\\(\\\\s-+\\|\\\\s-+\\)?fork\\>\\)" ;4,5 "\\|\\(\\\\)" ;6 "\\|\\(\\\\)" ;7 @@ -2570,6 +2586,9 @@ (eval-when-compile (verilog-regexp-words `("initial" "final" "always" "always_comb" "always_latch" "always_ff" "function" "task")))) (defconst verilog-coverpoint-re "\\w+\\s*:\\s*\\(coverpoint\\|cross\\constraint\\)" ) +(defconst verilog-in-constraint-re ;; keywords legal in constraint blocks starting a statement/block + (eval-when-compile (verilog-regexp-words `("if" "else" "solve" "foreach")))) + (defconst verilog-indent-re (eval-when-compile (verilog-regexp-words @@ -2682,7 +2701,7 @@ "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass" )))) (defconst verilog-disable-fork-re "\\(disable\\|wait\\)\\s-+fork\\>") -(defconst verilog-extended-case-re "\\(\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?\\)") +(defconst verilog-extended-case-re "\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\)") (defconst verilog-extended-complete-re (concat "\\(\\(\\\\s-+\\)?virtual\\s-+\\|\\\\|\\\\)\\)" "\\|\\(\\(\\\\s-+\\)*\\(\\\\|\\\\|\\\\)\\)" @@ -2766,6 +2785,8 @@ "let" "nexttime" "reject_on" "restrict" "s_always" "s_eventually" "s_nexttime" "s_until" "s_until_with" "strong" "sync_accept_on" "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak" + ;; 1800-2012 + "implements" "interconnect" "nettype" "soft" ) "List of Verilog keywords.") @@ -2786,7 +2807,7 @@ (modify-syntax-entry ?| "." table) ;; FIXME: This goes against Emacs conventions. Use "_" syntax instead and ;; then use regexps with things like "\\_<...\\_>". - (modify-syntax-entry ?` "w" table) + (modify-syntax-entry ?` "w" table) ;; ` is part of definition symbols in Verilog (modify-syntax-entry ?_ "w" table) (modify-syntax-entry ?\' "." table) @@ -2932,6 +2953,11 @@ "sync_accept_on" "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak" ) nil ))) + (verilog-1800-2012-keywords + (eval-when-compile + (verilog-regexp-opt + '("implements" "interconnect" "nettype" "soft" ) nil ))) + (verilog-ams-keywords (eval-when-compile (verilog-regexp-opt @@ -2995,6 +3021,12 @@ 'verilog-font-lock-p1800-face) (cons (concat "\\<\\(" verilog-1800-2009-keywords "\\)\\>") 'font-lock-type-face)) + ;; Fontify IEEE-1800-2012 keywords appropriately + (if verilog-highlight-p1800-keywords + (cons (concat "\\<\\(" verilog-1800-2012-keywords "\\)\\>") + 'verilog-font-lock-p1800-face) + (cons (concat "\\<\\(" verilog-1800-2012-keywords "\\)\\>") + 'font-lock-type-face)) ;; Fontify Verilog-AMS keywords (cons (concat "\\<\\(" verilog-ams-keywords "\\)\\>") 'verilog-font-lock-ams-face))) @@ -3113,7 +3145,7 @@ ;; Comment detection and caching (defvar verilog-scan-cache-preserving nil - "If set, the specified buffer's comment properties are static. + "If true, the specified buffer's comment properties are static. Buffer changes will be ignored. See `verilog-inside-comment-or-string-p' and `verilog-scan'.") @@ -3350,7 +3382,7 @@ (setq reg "\\(\\\\)\\|\\(\\\\)" )) ((match-end 2) ;; Search forward for matching endcase - (setq reg "\\(\\\\|\\(\\\\s-+\\|\\\\s-+\\)?\\[^:]\\)\\|\\(\\\\)" ) + (setq reg "\\(\\\\|\\(\\\\s-+\\|\\\\s-+\\)?\\[^:]\\)\\|\\(\\\\)" ) (setq md 3) ;; ender is third item in regexp ) ((match-end 4) @@ -3590,7 +3622,8 @@ \\[verilog-sk-fork] Insert a fork begin .. end .. join block. \\[verilog-sk-module] Insert a module .. (/*AUTOARG*/);.. endmodule block. \\[verilog-sk-ovm-class] Insert an OVM Class block. - \\[verilog-sk-uvm-class] Insert an UVM Class block. + \\[verilog-sk-uvm-object] Insert an UVM Object block. + \\[verilog-sk-uvm-component] Insert an UVM Component block. \\[verilog-sk-primitive] Insert a primitive .. (.. );.. endprimitive block. \\[verilog-sk-repeat] Insert a repeat (..) begin .. end block. \\[verilog-sk-specify] Insert a specify .. endspecify block. @@ -4062,9 +4095,8 @@ (error "%s: Can't find endmodule" (verilog-point-text)) (point-max))))) -(defun verilog-label-be (&optional arg) - "Label matching begin ... end, fork ... join and case ... endcase statements. -With ARG, first kill any existing labels." +(defun verilog-label-be () + "Label matching begin ... end, fork ... join and case ... endcase statements." (interactive) (let ((cnt 0) (oldpos (point)) @@ -4490,7 +4522,7 @@ ((looking-at "\\") (setq str "randcase") (setq err nil)) - ((looking-at "\\(\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?\\)") + ((looking-at "\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\)") (goto-char (match-end 0)) (setq str (concat (match-string 0) " " (verilog-get-expr))) (setq err nil)) @@ -5108,6 +5140,7 @@ (setq-default make-backup-files nil) (setq enable-local-variables t) (setq enable-local-eval t) + (setq create-lockfiles nil) ;; Make sure any sub-files we read get proper mode (setq-default major-mode 'verilog-mode) ;; Ditto files already read in @@ -5228,6 +5261,7 @@ (par 0) (begin (looking-at "[ \t]*begin\\>")) (lim (save-excursion (verilog-re-search-backward "\\(\\\\)\\|\\(\\\\)" nil t))) + (structres nil) (type (catch 'nesting ;; Keep working backwards until we can figure out ;; what type of statement this is. @@ -5246,8 +5280,12 @@ (looking-at "[ \t]*`vmm_"))))) (throw 'nesting 'directive)) ;; indent structs as if there were module level - (if (verilog-in-struct-p) - (throw 'nesting 'block)) + (setq structres (verilog-in-struct-nested-p)) + (cond ((not structres) nil) + ;;((and structres (equal (char-after) ?\})) (throw 'nesting 'struct-close)) + ((> structres 0) (throw 'nesting 'nested-struct)) + ((= structres 0) (throw 'nesting 'block)) + (t nil)) ;; if we are in a parenthesized list, and the user likes to indent these, return. ;; unless we are in the newfangled coverpoint or constraint blocks @@ -5264,7 +5302,9 @@ ;; trap out if we crawl off the top of the buffer (if (bobp) (throw 'nesting 'cpp)) - (if (verilog-continued-line-1 lim) + (if (and (verilog-continued-line-1 lim) + (or (not (verilog-in-coverage-p)) + (looking-at verilog-in-constraint-re) )) ;; may still get hosed if concat in constraint (let ((sp (point))) (if (and (not (looking-at verilog-complete-reg)) @@ -5273,10 +5313,15 @@ (throw 'nesting 'cexp)) (goto-char sp)) - + (if (and (verilog-in-coverage-p) + (looking-at verilog-in-constraint-re)) + (progn + (beginning-of-line) + (skip-chars-forward " \t") + (throw 'nesting 'constraint))) (if (and begin - (not verilog-indent-begin-after-if) - (looking-at verilog-no-indent-begin-re)) + (not verilog-indent-begin-after-if) + (looking-at verilog-no-indent-begin-re)) (progn (beginning-of-line) (skip-chars-forward " \t") @@ -5373,6 +5418,10 @@ (list type (current-column))) ((eq type 'defun) (list type 0)) + ((eq type 'constraint) + (list 'block (current-column))) + ((eq type 'nested-struct) + (list 'block structres)) (t (list type (verilog-current-indent-level)))))))) @@ -5401,23 +5450,32 @@ (t (setq depth (verilog-current-indent-level))))) (message "You are at nesting %s depth %d" type depth)))) + (defun verilog-calc-1 () (catch 'nesting - (let ((re (concat "\\({\\|}\\|" verilog-indent-re "\\)"))) + (let ((re (concat "\\({\\|}\\|" verilog-indent-re "\\)")) + (inconstraint (verilog-in-coverage-p))) (while (verilog-re-search-backward re nil 'move) (catch 'continue (cond ((equal (char-after) ?\{) + ;; block type returned based on outer contraint { or inner (if (verilog-at-constraint-p) - (throw 'nesting 'block))) - + (cond (inconstraint (throw 'nesting 'constraint)) + (t (throw 'nesting 'statement))))) ((equal (char-after) ?\}) - (let ((there (verilog-at-close-constraint-p))) + (let (par-pos + (there (verilog-at-close-constraint-p))) (if there ;; we are at the } that closes a constraint. Find the { that opens it (progn - (forward-char 1) - (backward-list 1) - (verilog-beg-of-statement))))) + (if (> (verilog-in-paren-count) 0) + (forward-char 1)) + (setq par-pos (verilog-parenthesis-depth)) + (cond (par-pos + (goto-char par-pos) + (forward-char 1)) + (t + (backward-char 1))))))) ((looking-at verilog-beg-block-re-ordered) (cond @@ -5535,7 +5593,7 @@ (while (/= 0 nest) (verilog-re-search-backward (concat - "\\(\\\\|\\(\\\\)" + "\\(\\\\|\\(\\\\)" "\\|\\(\\\\)" ) nil 'move) (cond @@ -5951,6 +6009,14 @@ (let ((state (save-excursion (verilog-syntax-ppss)))) (> (nth 0 state) 0 ))) +(defun verilog-in-paren-count () + "Return paren depth, floor to 0. +May cache result using `verilog-syntax-ppss'." + (let ((state (save-excursion (verilog-syntax-ppss)))) + (if (> (nth 0 state) 0) + (nth 0 state) + 0 ))) + (defun verilog-in-paren-quick () "Return true if in a parenthetical expression. Always starts from `point-min', to allow inserts with hooks disabled." @@ -5970,6 +6036,21 @@ ) nil))) +(defun verilog-in-struct-nested-p () + "Return nil for not in struct. +Return 0 for in non-nested struct. +Return >0 for nested struct." + (interactive) + (let (col) + (save-excursion + (if (verilog-in-paren) + (progn + (verilog-backward-up-list 1) + (setq col (verilog-at-struct-mv-p)) + (if col + (if (verilog-in-struct-p) (current-column) 0))) + nil)))) + (defun verilog-in-coverage-p () "Return true if in a constraint or coverpoint expression." (interactive) @@ -5984,11 +6065,13 @@ "If at the } that closes a constraint or covergroup, return true." (if (and (equal (char-after) ?\}) - (verilog-in-paren)) + (verilog-in-coverage-p)) (save-excursion (verilog-backward-ws&directives) - (if (equal (char-before) ?\;) + (if (or (equal (char-before) ?\;) + (equal (char-before) ?\}) ;; can end with inner constraint { } block or ; + (equal (char-before) ?\{)) ;; empty constraint block (point) nil)))) @@ -6000,19 +6083,63 @@ (forward-list) (progn (backward-char 1) (verilog-backward-ws&directives) - (equal (char-before) ?\;)))) - ;; maybe - (verilog-re-search-backward "\\" nil 'move) + (or (equal (char-before) ?\{) ;; empty case + (equal (char-before) ?\;) + (equal (char-before) ?\}))))) + (progn + (let ( (pt (point)) (pass 0)) + (verilog-backward-ws&directives) + (verilog-backward-token) + (if (looking-at (concat "\\\\|" verilog-in-constraint-re)) + (progn (setq pass 1) + (if (looking-at "\\") + (progn (verilog-backward-ws&directives) + (beginning-of-line) ;; 1 + (verilog-forward-ws&directives) + 1 ) + (verilog-beg-of-statement) + )) + ;; if first word token not keyword, it maybe the instance name + ;; check next word token + (if (looking-at "\\<\\w+\\>\\|\\s-*(\\s-*\\w+") + (progn (verilog-beg-of-statement) + (if (looking-at (concat "\\<\\(constraint\\|" + "\\(?:\\w+\\s-*:\\s-*\\)?\\(coverpoint\\|cross\\)" + "\\|with\\)\\>\\|" verilog-in-constraint-re)) + (setq pass 1))))) + (if (eq pass 0) + (progn (goto-char pt) nil) 1))) ;; not nil)) (defun verilog-at-struct-p () + "If at the { of a struct, return true, not moving point." + (save-excursion + (if (and (equal (char-after) ?\{) + (verilog-backward-token)) + (looking-at "\\") + nil))) + +(defun verilog-at-struct-mv-p () "If at the { of a struct, return true, moving point to struct." - (save-excursion + (let ((pt (point))) (if (and (equal (char-after) ?\{) (verilog-backward-token)) - (looking-at "\\") - nil))) + (if (looking-at "\\") + (progn (verilog-beg-of-statement) (point)) + (progn (goto-char pt) nil)) + (progn (goto-char pt) nil)))) + +(defun verilog-at-close-struct-p () + "If at the } that closes a struct, return true." + (if (and + (equal (char-after) ?\}) + (verilog-in-struct-p)) + ;; true + (save-excursion + (if (looking-at "}\\(?:\\s-*\\w+\\s-*\\)?;") 1)) + ;; false + nil)) (defun verilog-parenthesis-depth () "Return non zero if in parenthetical-expression." @@ -6247,8 +6374,9 @@ (;-- Handle the ends (or - (looking-at verilog-end-block-re ) - (verilog-at-close-constraint-p)) + (looking-at verilog-end-block-re) + (verilog-at-close-constraint-p) + (verilog-at-close-struct-p)) (let ((val (if (eq type 'statement) (- ind verilog-indent-level) ind))) @@ -7466,11 +7594,11 @@ (list name bits comment mem enum signed type multidim modport)) (defsubst verilog-sig-name (sig) (car sig)) -(defsubst verilog-sig-bits (sig) +(defsubst verilog-sig-bits (sig) ;; First element of packed array (pre signal-name) (nth 1 sig)) (defsubst verilog-sig-comment (sig) (nth 2 sig)) -(defsubst verilog-sig-memory (sig) +(defsubst verilog-sig-memory (sig) ;; Unpacked array (post signal-name) (nth 3 sig)) (defsubst verilog-sig-enum (sig) (nth 4 sig)) @@ -7480,7 +7608,7 @@ (nth 6 sig)) (defsubst verilog-sig-type-set (sig type) (setcar (nthcdr 6 sig) type)) -(defsubst verilog-sig-multidim (sig) +(defsubst verilog-sig-multidim (sig) ;; Second and additional elements of packed array (nth 7 sig)) (defsubst verilog-sig-multidim-string (sig) (if (verilog-sig-multidim sig) @@ -7666,7 +7794,7 @@ (nreverse out-list))) (defun verilog-signals-with (func in-list) - "Return IN-LIST with only signals where FUNC passed each signal is true." + "Return list of signals where FUNC is true executed on each signal in IN-LIST." (let (out-list) (while in-list (when (funcall func (car in-list)) @@ -7764,7 +7892,7 @@ `verilog-auto-reset-widths'." (concat (if (and verilog-active-low-regexp - (string-match verilog-active-low-regexp (verilog-sig-name sig))) + (verilog-string-match-fold verilog-active-low-regexp (verilog-sig-name sig))) "~" "") (cond ((not verilog-auto-reset-widths) "0") @@ -7871,6 +7999,12 @@ (verilog-backward-open-paren) (verilog-re-search-backward-quick "\\b[a-zA-Z0-9`_\$]" nil nil)) (skip-chars-backward "a-zA-Z0-9'_$") + ;; #1 is legal syntax for gate primitives + (when (save-excursion + (verilog-backward-syntactic-ws-quick) + (eq ?# (char-before))) + (verilog-re-search-backward-quick "\\b[a-zA-Z0-9`_\$]" nil nil) + (skip-chars-backward "a-zA-Z0-9'_$")) (looking-at "[a-zA-Z0-9`_\$]+") ;; Important: don't use match string, this must work with Emacs 19 font-lock on (buffer-substring-no-properties (match-beginning 0) (match-end 0)) @@ -8108,7 +8242,12 @@ ;; Type? ((unless ptype (verilog-typedef-name-p keywd)) - (setq typedefed keywd)) + (cond (io + (setq typedefed + (if typedefed (concat typedefed " " keywd) keywd))) + (t (setq vec nil enum nil rvalue nil signed nil + typedefed nil multidim nil sig-paren paren + expect-signal 'sigs-var modport nil)))) ;; Interface with optional modport in v2k arglist? ;; Skip over parsing modport, and take the interface name as the type ((and v2kargs-ok @@ -8199,9 +8338,18 @@ ;; - we want an error when we are debugging this code if they are refed. (defvar sigs-in) (defvar sigs-inout) + (defvar sigs-intf) + (defvar sigs-intfd) (defvar sigs-out) - (defvar sigs-intf) - (defvar sigs-intfd)) + (defvar sigs-out-d) + (defvar sigs-out-i) + (defvar sigs-out-unk) + (defvar sigs-temp) + ;; These are known to be from other packages and may not be defined + (defvar diff-command nil) + (defvar vector-skip-list) + ;; There are known to be from newer versions of Emacs + (defvar create-lockfiles)) (defun verilog-read-sub-decls-sig (submoddecls comment port sig vec multidim) "For `verilog-read-sub-decls-line', add a signal." @@ -8458,7 +8606,7 @@ (subprim (member submod verilog-gate-keywords)) (comment (concat inst " of " submod ".v")) submodi submoddecls) - (cond + (cond (subprim (setq submodi `primitive submoddecls (verilog-decls-new nil nil nil nil nil nil nil nil nil) @@ -8575,17 +8723,6 @@ (verilog-in-hooks t)) (eval-region beg-pt end-pt nil)))))) -(eval-when-compile - ;; Prevent compile warnings; these are let's, not globals - ;; Do not remove the eval-when-compile - ;; - we want an error when we are debugging this code if they are refed. - (defvar sigs-in) - (defvar sigs-out-d) - (defvar sigs-out-i) - (defvar sigs-out-unk) - (defvar sigs-temp) - (defvar vector-skip-list)) - (defun verilog-read-always-signals-recurse (exit-keywd rvalue temp-next) "Recursive routine for parentheses/bracket matching. @@ -8971,8 +9108,9 @@ (while (re-search-forward "^\\s-*`define\\s-+\\([a-zA-Z0-9_$]+\\)\\s-+\\(.*\\)$" nil t) (let ((defname (match-string-no-properties 1)) (defvalue (match-string-no-properties 2))) - (setq defvalue (verilog-string-replace-matches "\\s-*/[/*].*$" "" nil nil defvalue)) - (verilog-set-define defname defvalue origbuf))) + (unless (verilog-inside-comment-or-string-p (match-beginning 0)) + (setq defvalue (verilog-string-replace-matches "\\s-*/[/*].*$" "" nil nil defvalue)) + (verilog-set-define defname defvalue origbuf)))) ;; Hack: Read parameters (goto-char (point-min)) (while (re-search-forward @@ -8985,8 +9123,9 @@ (forward-comment 99999) (while (looking-at (concat "\\s-*,?\\s-*\\(?:/[/*].*?$\\)?\\s-*\\([a-zA-Z0-9_$]+\\)" "\\s-*=\\s-*\\([^;,]*\\),?\\s-*\\(/[/*].*?$\\)?\\s-*")) - (verilog-set-define (match-string-no-properties 1) - (match-string-no-properties 2) origbuf enumname) + (unless (verilog-inside-comment-or-string-p (match-beginning 0)) + (verilog-set-define (match-string-no-properties 1) + (match-string-no-properties 2) origbuf enumname)) (goto-char (match-end 0)) (forward-comment 99999))))))) @@ -9189,7 +9328,7 @@ ;; (defvar verilog-dir-cache-preserving nil - "If set, the directory cache is enabled, and file system changes are ignored. + "If true, the directory cache is enabled, and file system changes are ignored. See `verilog-dir-exists-p' and `verilog-dir-files'.") ;; If adding new cached variable, add also to verilog-preserve-dir-cache @@ -9678,7 +9817,8 @@ "Return all signals in IN-LIST matching the given REGEXP, if non-nil." (if (or (not regexp) (equal regexp "")) in-list - (let (out-list) + (let ((case-fold-search verilog-case-fold) + out-list) (while in-list (if (string-match regexp (verilog-sig-name (car in-list))) (setq out-list (cons (car in-list) out-list))) @@ -9689,7 +9829,8 @@ "Return all signals in IN-LIST not matching the given REGEXP, if non-nil." (if (or (not regexp) (equal regexp "")) in-list - (let (out-list) + (let ((case-fold-search verilog-case-fold) + out-list) (while in-list (if (not (string-match regexp (verilog-sig-name (car in-list)))) (setq out-list (cons (car in-list) out-list))) @@ -10019,7 +10160,7 @@ (defun verilog-typedef-name-p (variable-name) "Return true if the VARIABLE-NAME is a type definition." (when verilog-typedef-regexp - (string-match verilog-typedef-regexp variable-name))) + (verilog-string-match-fold verilog-typedef-regexp variable-name))) ;; ;; Auto deletion @@ -10388,7 +10529,7 @@ (let ((name1 (with-current-buffer b1 (buffer-file-name)))) (verilog-warn "%s:%d: Difference in AUTO expansion found" name1 (with-current-buffer b1 - (1+ (count-lines (point-min) (point))))) + (count-lines (point-min) diffpt))) (cond (noninteractive (verilog-diff-file-with-buffer name1 b2 t t)) (t @@ -10617,7 +10758,6 @@ ;; Note this may raise an error (when (setq submodi (verilog-modi-lookup submod t)) (let* ((indent-pt (current-indentation)) - (modi (verilog-modi-current)) (submoddecls (verilog-modi-get-decls submodi)) (submodportdecls (verilog-modi-modport-lookup submodi modport-re)) (sig-list-i (verilog-signals-in ;; Decls doesn't have data types, must resolve @@ -10694,7 +10834,7 @@ "")) (case-fold-search nil) (check-values par-values) - tpl-net) + tpl-net dflt-bits) ;; Replace parameters in bit-width (when (and check-values (not (equal vl-bits ""))) @@ -10712,11 +10852,14 @@ vl-mbits (verilog-simplify-range-expression vl-mbits) vl-width (verilog-make-width-expression vl-bits))) ; Not in the loop for speed ;; Default net value if not found - (setq tpl-net (concat port + (setq dflt-bits (if (and (verilog-sig-bits port-st) + (or (verilog-sig-multidim port-st) + (verilog-sig-memory port-st))) + (concat "/*" vl-mbits vl-bits "*/") + (concat vl-bits)) + tpl-net (concat port (if vl-modport (concat "." vl-modport) "") - (if (verilog-sig-multidim port-st) - (concat "/*" vl-mbits vl-bits "*/") - (concat vl-bits)))) + dflt-bits)) ;; Find template (cond (tpl-ass ; Template of exact port name (setq tpl-net (nth 1 tpl-ass))) @@ -10749,6 +10892,7 @@ (substring tpl-net (match-end 0)))))) ;; Replace @ and [] magic variables in final output (setq tpl-net (verilog-string-replace-matches "@" tpl-num nil nil tpl-net)) + (setq tpl-net (verilog-string-replace-matches "\\[\\]\\[\\]" dflt-bits nil nil tpl-net)) (setq tpl-net (verilog-string-replace-matches "\\[\\]" vl-bits nil nil tpl-net))) ;; Insert it (indent-to indent-pt) @@ -10861,6 +11005,10 @@ AUTOWIRE declarations, etc. Gates are the only case when position based connections are passed. + The array part of arrayed instances are ignored; this may + result in undesirable default AUTOINST connections; use a + template instead. + For example, first take the submodule InstModule.v: module InstModule (o,i); @@ -10940,6 +11088,19 @@ words and capitalized. Only signals that must be different for each instantiation need to be listed. + Inside a template, a [] in a connection name (with nothing else + inside the brackets) will be replaced by the same bus subscript + as it is being connected to, or the [] will be removed if it is + a single bit signal. + + Inside a template, a [][] in a connection name will behave + similarly to a [] for scalar or single-dimensional connection; + for a multidimensional connection it will print a comment + similar to that printed when a template is not used. Generally + it is a good idea to do this for all connections in a template, + as then they will work for any width signal, and with AUTOWIRE. + See PTL_BUS becoming PTL_BUSNEW below. + Inside a template, a [] in a connection name (with nothing else inside the brackets) will be replaced by the same bus subscript as it is being connected to, or the [] will be removed if it is a single bit signal. @@ -11159,7 +11320,7 @@ ;; automatic variable instantiation program. (let* ((tpl-info (verilog-read-auto-template submod)) (tpl-regexp (aref tpl-info 0))) - (setq tpl-num (if (string-match tpl-regexp inst) + (setq tpl-num (if (verilog-string-match-fold tpl-regexp inst) (match-string 1 inst) "") tpl-list (aref tpl-info 1))) @@ -11302,7 +11463,7 @@ ;; automatic variable instantiation program. (let* ((tpl-info (verilog-read-auto-template submod)) (tpl-regexp (aref tpl-info 0))) - (setq tpl-num (if (string-match tpl-regexp inst) + (setq tpl-num (if (verilog-string-match-fold tpl-regexp inst) (match-string 1 inst) "") tpl-list (aref tpl-info 1))) @@ -11593,6 +11754,7 @@ (verilog-subdecls-get-outputs modsubdecls) (append (verilog-decls-get-outputs moddecls) (verilog-decls-get-inouts moddecls) + (verilog-decls-get-inputs moddecls) (verilog-subdecls-get-inputs modsubdecls) (verilog-subdecls-get-inouts modsubdecls))))) (when regexp @@ -11719,6 +11881,7 @@ (verilog-subdecls-get-inputs modsubdecls) (append (verilog-decls-get-inputs moddecls) (verilog-decls-get-inouts moddecls) + (verilog-decls-get-outputs moddecls) (verilog-decls-get-vars moddecls) (verilog-decls-get-consts moddecls) (verilog-decls-get-gparams moddecls) @@ -12062,67 +12225,36 @@ If placed inside the parenthesis of a module declaration, it creates Verilog 2001 style, else uses Verilog 1995 style. - Concatenation and outputting partial buses is not supported. - Module names must be resolvable to filenames. See `verilog-auto-inst'. - Signals are not inserted in the same order as in the original module, - though they will appear to be in the same order to an AUTOINST - instantiating either module. + Parameters are inserted in the same order as in the original module. - Signals declared as \"output reg\" or \"output wire\" etc will - lose the wire/reg declaration so that shell modules may - generate those outputs differently. However, \"output logic\" - is propagated. + Parameters do not have values, which is SystemVerilog 2009 syntax. An example: - module ExampShell (/*AUTOARG*/); - /*AUTOINOUTMODULE(\"ExampMain\")*/ + module ExampShell (); + /*AUTOINOUTPARAM(\"ExampMain\")*/ endmodule - module ExampMain (i,o,io); - input i; - output o; - inout io; + module ExampMain (); + parameter PARAM = 22; endmodule Typing \\[verilog-auto] will make this into: module ExampShell (/*AUTOARG*/i,o,io); - /*AUTOINOUTMODULE(\"ExampMain\")*/ - // Beginning of automatic in/out/inouts (from specific module) - output o; - inout io; - input i; + /*AUTOINOUTPARAM(\"ExampMain\")*/ + // Beginning of automatic parameters (from specific module) + parameter PARAM; // End of automatics endmodule You may also provide an optional regular expression, in which case only -signals matching the regular expression will be included. For example the -same expansion will result from only extracting signals starting with i: - - /*AUTOINOUTMODULE(\"ExampMain\",\"^i\")*/ - -You may also provide an optional second regular expression, in -which case only signals which have that pin direction and data -type will be included. This matches against everything before -the signal name in the declaration, for example against -\"input\" (single bit), \"output logic\" (direction and type) or -\"output [1:0]\" (direction and implicit type). You also -probably want to skip spaces in your regexp. - -For example, the below will result in matching the output \"o\" -against the previous example's module: - - /*AUTOINOUTMODULE(\"ExampMain\",\"\",\"^output.*\")*/ - -You may also provide an optional third regular expression, in -which case any parameter names that match the given regexp will -be included. Including parameters is off by default. To include -all signals and parameters, use: - - /*AUTOINOUTMODULE(\"ExampMain\",\".*\",\".*\",\".*\")*/" +parameters matching the regular expression will be included. For example the +same expansion will result from only extracting parameters starting with i: + + /*AUTOINOUTPARAM(\"ExampMain\",\"^i\")*/" (save-excursion (let* ((params (verilog-read-auto-params 1 2)) (submod (nth 0 params)) @@ -12896,7 +13028,7 @@ ;; count(enums) == width(sig) (equal (number-to-string (length enum-sigs)) (verilog-sig-width undecode-sig))))) - (enum-chars 0) + (enum-chars 0) (ascii-chars 0)) ;; ;; Find number of ascii chars needed @@ -13019,6 +13151,9 @@ Use \\[verilog-faq] for a pointer to frequently asked questions. +For new users, we recommend setting `verilog-case-fold' to nil +and `verilog-auto-arg-sort' to t. + The hooks `verilog-before-auto-hook' and `verilog-auto-hook' are called before and after this function, respectively. @@ -13044,12 +13179,12 @@ `verilog-auto-arg' for AUTOARG module instantiations `verilog-auto-ascii-enum' for AUTOASCIIENUM enumeration decoding `verilog-auto-assign-modport' for AUTOASSIGNMODPORT assignment to/from modport + `verilog-auto-inout' for AUTOINOUT making hierarchy inouts `verilog-auto-inout-comp' for AUTOINOUTCOMP copy complemented i/o `verilog-auto-inout-in' for AUTOINOUTIN inputs for all i/o `verilog-auto-inout-modport' for AUTOINOUTMODPORT i/o from an interface modport `verilog-auto-inout-module' for AUTOINOUTMODULE copying i/o from elsewhere `verilog-auto-inout-param' for AUTOINOUTPARAM copying params from elsewhere - `verilog-auto-inout' for AUTOINOUT making hierarchy inouts `verilog-auto-input' for AUTOINPUT making hierarchy inputs `verilog-auto-insert-lisp' for AUTOINSERTLISP insert code from lisp function `verilog-auto-inst' for AUTOINST instantiation pins @@ -13061,7 +13196,7 @@ `verilog-auto-reg' for AUTOREG registers `verilog-auto-reg-input' for AUTOREGINPUT instantiation registers `verilog-auto-reset' for AUTORESET flop resets - `verilog-auto-sense' for AUTOSENSE always sensitivity lists + `verilog-auto-sense' for AUTOSENSE or AS always sensitivity lists `verilog-auto-tieoff' for AUTOTIEOFF output tieoffs `verilog-auto-undef' for AUTOUNDEF `undef of local `defines `verilog-auto-unused' for AUTOUNUSED unused inputs/inouts @@ -13080,6 +13215,7 @@ (verilog-save-font-mods (let ((oldbuf (if (not (buffer-modified-p)) (buffer-string))) + (case-fold-search verilog-case-fold) ;; Cache directories; we don't write new files, so can't change (verilog-dir-cache-preserving t) ;; Cache current module @@ -13210,7 +13346,7 @@ (define-key map "r" 'verilog-sk-repeat) (define-key map "s" 'verilog-sk-specify) (define-key map "t" 'verilog-sk-task) - (define-key map "u" 'verilog-sk-uvm-class) + (define-key map "u" 'verilog-sk-uvm-object) (define-key map "w" 'verilog-sk-while) (define-key map "x" 'verilog-sk-casex) (define-key map "z" 'verilog-sk-casez) @@ -13223,6 +13359,7 @@ (define-key map "O" 'verilog-sk-output) (define-key map "S" 'verilog-sk-state-machine) (define-key map "=" 'verilog-sk-inout) + (define-key map "U" 'verilog-sk-uvm-component) (define-key map "W" 'verilog-sk-wire) (define-key map "R" 'verilog-sk-reg) (define-key map "D" 'verilog-sk-define-signal) @@ -13339,13 +13476,13 @@ > _ \n > "endclass" (progn (electric-verilog-terminate-line) nil)) -(define-skeleton verilog-sk-uvm-class +(define-skeleton verilog-sk-uvm-object "Insert a class definition" () > "class " (setq name (skeleton-read "Name: ")) " extends " (skeleton-read "Extends: ") ";" \n > _ \n > "`uvm_object_utils_begin(" name ")" \n - > (- verilog-indent-level) " `uvm_object_utils_end" \n + > (- verilog-indent-level) "`uvm_object_utils_end" \n > _ \n > "function new(name=\"" name "\");" \n > "super.new(name);" \n @@ -13353,6 +13490,20 @@ > _ \n > "endclass" (progn (electric-verilog-terminate-line) nil)) +(define-skeleton verilog-sk-uvm-component + "Insert a class definition" + () + > "class " (setq name (skeleton-read "Name: ")) " extends " (skeleton-read "Extends: ") ";" \n + > _ \n + > "`uvm_component_utils_begin(" name ")" \n + > (- verilog-indent-level) "`uvm_component_utils_end" \n + > _ \n + > "function new(name=\"\", uvm_component parent);" \n + > "super.new(name, parent);" \n + > (- verilog-indent-level) "endfunction" \n + > _ \n + > "endclass" (progn (electric-verilog-terminate-line) nil)) + (define-skeleton verilog-sk-primitive "Insert a task definition." () @@ -13797,6 +13948,7 @@ verilog-before-getopt-flags-hook verilog-before-save-font-hook verilog-cache-enabled + verilog-case-fold verilog-case-indent verilog-cexp-indent verilog-compiler @@ -13823,7 +13975,6 @@ verilog-linter verilog-minimum-comment-distance verilog-mode-hook - verilog-mode-release-date verilog-mode-release-emacs verilog-mode-version verilog-preprocessor ------------------------------------------------------------ revno: 114705 committer: Glenn Morris branch nick: trunk timestamp: Fri 2013-10-18 00:03:48 -0700 message: Standardize license notice diff: === modified file 'test/automated/timer-tests.el' --- test/automated/timer-tests.el 2013-10-18 04:27:34 +0000 +++ test/automated/timer-tests.el 2013-10-18 07:03:48 +0000 @@ -4,18 +4,18 @@ ;; This file is part of GNU Emacs. -;; This program is free software: you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation, either version 3 of the -;; License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. -;; +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see `http://www.gnu.org/licenses/'. +;; along with GNU Emacs. If not, see . ;;; Commentary: ------------------------------------------------------------ revno: 114704 fixes bug: http://debbugs.gnu.org/15045 committer: Barry O'Reilly branch nick: trunk timestamp: Fri 2013-10-18 00:27:34 -0400 message: Don't run timers in input-pending-p. Its new check-timers param provides the prior behavior.. * src/keyboard.c (Finput_pending_p): Accept optional check-timers param. * lisp/subr.el (sit-for): Call (input-pending-p t) so as to behave as before. * test/automated/timer-tests.el: New file. Tests that (sit-for 0) allows another timer to run. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-10-16 00:21:06 +0000 +++ etc/NEWS 2013-10-18 04:27:34 +0000 @@ -620,6 +620,9 @@ * Incompatible Lisp Changes in Emacs 24.4 +** `(input-pending-p)' no longer runs other timers which are ready to +run. The new optional CHECK-TIMERS param allows for the prior behavior. + ** `defvar' and `defcustom' in a let-binding affect the "external" default. ** The syntax of ?» and ?« is now punctuation instead of matched parens. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-18 02:26:28 +0000 +++ lisp/ChangeLog 2013-10-18 04:27:34 +0000 @@ -1,3 +1,8 @@ +2013-10-17 Barry O'Reilly + + * lisp/subr.el (sit-for): Call (input-pending-p t) so as to behave + as before. + 2013-10-18 Reuben Thomas * textmodes/remember.el (remember): set buffer-offer-save in === modified file 'lisp/subr.el' --- lisp/subr.el 2013-10-04 19:06:45 +0000 +++ lisp/subr.el 2013-10-18 04:27:34 +0000 @@ -2222,7 +2222,7 @@ (noninteractive (sleep-for seconds) t) - ((input-pending-p) + ((input-pending-p t) nil) ((<= seconds 0) (or nodisp (redisplay))) === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-17 06:42:21 +0000 +++ src/ChangeLog 2013-10-18 04:27:34 +0000 @@ -1,3 +1,10 @@ +2013-10-17 Barry O'Reilly + + Don't run timers in input-pending-p. Its new check-timers param + provides the prior behavior. (Bug#15045). + * src/keyboard.c (Finput_pending_p): Accept optional check-timers + param. + 2013-10-17 Paul Eggert Make some functions static in non-Microsoft builds. === modified file 'src/keyboard.c' --- src/keyboard.c 2013-10-17 06:42:21 +0000 +++ src/keyboard.c 2013-10-18 04:27:34 +0000 @@ -9950,12 +9950,13 @@ return (!NILP (Vunread_command_events)); } - -DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 0, 0, +DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0, doc: /* Return t if command input is currently available with no wait. Actually, the value is nil only if we can be sure that no input is available; -if there is a doubt, the value is t. */) - (void) +if there is a doubt, the value is t. + +If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */) + (Lisp_Object check_timers) { if (!NILP (Vunread_command_events) || !NILP (Vunread_post_input_method_events) @@ -9965,7 +9966,8 @@ /* Process non-user-visible events (Bug#10195). */ process_special_events (); - return (get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW + return (get_input_pending ((NILP (check_timers) + ? 0 : READABLE_EVENTS_DO_TIMERS_NOW) | READABLE_EVENTS_FILTER_EVENTS) ? Qt : Qnil); } === modified file 'test/ChangeLog' --- test/ChangeLog 2013-10-15 06:36:43 +0000 +++ test/ChangeLog 2013-10-18 04:27:34 +0000 @@ -1,3 +1,8 @@ +2013-10-17 Barry O'Reilly + + * test/automated/timer-tests.el: New file. Tests that (sit-for 0) + allows another timer to run. + 2013-10-14 Dmitry Gutov * indent/ruby.rb: More examples for bug#15594, both failing and === added file 'test/automated/timer-tests.el' --- test/automated/timer-tests.el 1970-01-01 00:00:00 +0000 +++ test/automated/timer-tests.el 2013-10-18 04:27:34 +0000 @@ -0,0 +1,38 @@ +;;; timer-tests.el --- tests for timers -*- lexical-binding:t -*- + +;; Copyright (C) 2013 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program is free software: you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation, either version 3 of the +;; License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see `http://www.gnu.org/licenses/'. + +;;; Commentary: + +;;; Code: + +(ert-deftest timer-tests-sit-for () + (let ((timer-ran nil) + ;; Want sit-for behavior when interactive + (noninteractive nil)) + (run-at-time '(0 0 0 0) + nil + (lambda () (setq timer-ran t))) + ;; The test assumes run-at-time didn't take the liberty of firing + ;; the timer, so assert the test's assumption + (should (not timer-ran)) + (sit-for 0 t) + (should timer-ran))) + +;;; timer-tests.el ends here + ------------------------------------------------------------ revno: 114703 committer: Reuben Thomas branch nick: trunk timestamp: Fri 2013-10-18 03:26:28 +0100 message: * lisp/textmodes/remember.el (remember): set buffer-offer-save in remember buffers. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-18 00:55:15 +0000 +++ lisp/ChangeLog 2013-10-18 02:26:28 +0000 @@ -1,3 +1,8 @@ +2013-10-18 Reuben Thomas + + * textmodes/remember.el (remember): set buffer-offer-save in + remember buffers (bug#13566). + 2013-10-18 Daniel Colascione When evaluating forms in ielm, direct standard output to ielm @@ -6905,6 +6910,7 @@ * progmodes/f90.el (f90-imenu-generic-expression): Fix typo in 2013-05-08 change. (Bug#14402) +>>>>>>> MERGE-SOURCE 2013-05-14 Jean-Philippe Gravel * progmodes/gdb-mi.el (gdb-running, gdb-starting): === modified file 'lisp/textmodes/remember.el' --- lisp/textmodes/remember.el 2013-06-30 22:29:23 +0000 +++ lisp/textmodes/remember.el 2013-10-18 02:26:28 +0000 @@ -294,6 +294,7 @@ (if remember-in-new-frame (set-window-dedicated-p (get-buffer-window (current-buffer) (selected-frame)) t)) + (setq buffer-offer-save t) (remember-mode) (when (= (point-max) (point-min)) (when initial (insert initial)) ------------------------------------------------------------ revno: 114702 committer: Daniel Colascione branch nick: trunk timestamp: Thu 2013-10-17 16:55:15 -0800 message: IELM improvements. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-17 19:39:22 +0000 +++ lisp/ChangeLog 2013-10-18 00:55:15 +0000 @@ -1,3 +1,19 @@ +2013-10-18 Daniel Colascione + + When evaluating forms in ielm, direct standard output to ielm + buffer. Add new ielm-return-for-effect command. Remove trailing + whitespace throughout. + + * ielm.el (ielm-map): Bind M-RET to ielm-return-for-effect. + (ielm-return-for-effect): New command. + (ielm-send-input): Accept optional `for-effect' parameter. + (ielm-eval-input): Accept optional `for-effect' parameter. Bind + `standard-output' to stream we create using + `ielm-standard-output-impl'. Suppress printing result when + `for-effect'. + (ielm-standard-output-impl): New function. + (inferior-emacs-lisp-mode): Explain new features in documentation. + 2013-10-17 Michael Albinus Code cleanup. === modified file 'lisp/ielm.el' --- lisp/ielm.el 2013-05-30 03:30:34 +0000 +++ lisp/ielm.el 2013-10-18 00:55:15 +0000 @@ -1,3 +1,4 @@ +;;; -*- lexical-binding: t -*- ;;; ielm.el --- interaction mode for Emacs Lisp ;; Copyright (C) 1994, 2001-2013 Free Software Foundation, Inc. @@ -62,10 +63,10 @@ wish to put something like the following in your init file: \(add-hook 'ielm-mode-hook - (lambda () - (define-key ielm-map \"\\C-w\" 'comint-kill-region) - (define-key ielm-map [C-S-backspace] - 'comint-kill-whole-line))) + (lambda () + (define-key ielm-map \"\\C-w\" 'comint-kill-region) + (define-key ielm-map [C-S-backspace] + 'comint-kill-whole-line))) If you set `comint-prompt-read-only' to t, you might wish to use `comint-mode-hook' and `comint-mode-map' instead of @@ -169,6 +170,7 @@ (let ((map (make-sparse-keymap))) (define-key map "\t" 'completion-at-point) (define-key map "\C-m" 'ielm-return) + (define-key map "\e\C-m" 'ielm-return-for-effect) (define-key map "\C-j" 'ielm-send-input) (define-key map "\e\C-x" 'eval-defun) ; for consistency with (define-key map "\e\t" 'completion-at-point) ; lisp-interaction-mode @@ -203,7 +205,7 @@ "Possibly indent the current line as Lisp code." (interactive) (when (or (eq (preceding-char) ?\n) - (eq (char-syntax (preceding-char)) ?\s)) + (eq (char-syntax (preceding-char)) ?\s)) (ielm-indent-line) t)) @@ -212,9 +214,9 @@ ;; A wrapper for completion-at-point that returns non-nil if ;; completion has occurred (let* ((btick (buffer-modified-tick)) - (cbuffer (get-buffer "*Completions*")) - (ctick (and cbuffer (buffer-modified-tick cbuffer))) - (completion-at-point-functions '(lisp-completion-at-point))) + (cbuffer (get-buffer "*Completions*")) + (ctick (and cbuffer (buffer-modified-tick cbuffer))) + (completion-at-point-functions '(lisp-completion-at-point))) (completion-at-point) ;; completion has occurred if: (or @@ -222,7 +224,7 @@ (not (= btick (buffer-modified-tick))) ;; a completions buffer has been modified or created (if cbuffer - (not (= ctick (buffer-modified-tick cbuffer))) + (not (= ctick (buffer-modified-tick cbuffer))) (get-buffer "*Completions*"))))) (defun ielm-complete-filename nil @@ -258,13 +260,13 @@ (interactive "bSet working buffer to: ") (let ((buffer (get-buffer buf))) (if (and buffer (buffer-live-p buffer)) - (setq ielm-working-buffer buffer) + (setq ielm-working-buffer buffer) (error "No such buffer: %S" buf))) (ielm-print-working-buffer)) ;;; Other bindings -(defun ielm-return nil +(defun ielm-return (&optional for-effect) "Newline and indent, or evaluate the sexp before the prompt. Complete sexps are evaluated; for incomplete sexps inserts a newline and indents. If however `ielm-dynamic-return' is nil, this always @@ -272,22 +274,27 @@ (interactive) (if ielm-dynamic-return (let ((state - (save-excursion - (end-of-line) - (parse-partial-sexp (ielm-pm) - (point))))) - (if (and (< (car state) 1) (not (nth 3 state))) - (ielm-send-input) - (when (and ielm-dynamic-multiline-inputs - (save-excursion - (beginning-of-line) - (looking-at-p comint-prompt-regexp))) - (save-excursion - (goto-char (ielm-pm)) - (newline 1))) - (newline-and-indent))) + (save-excursion + (end-of-line) + (parse-partial-sexp (ielm-pm) + (point))))) + (if (and (< (car state) 1) (not (nth 3 state))) + (ielm-send-input for-effect) + (when (and ielm-dynamic-multiline-inputs + (save-excursion + (beginning-of-line) + (looking-at-p comint-prompt-regexp))) + (save-excursion + (goto-char (ielm-pm)) + (newline 1))) + (newline-and-indent))) (newline))) +(defun ielm-return-for-effect () + "Like `ielm-return', but do not print the result." + (interactive) + (ielm-return t)) + (defvar ielm-input) (defun ielm-input-sender (_proc input) @@ -295,12 +302,12 @@ ;; `ielm-send-input's call. (setq ielm-input input)) -(defun ielm-send-input nil +(defun ielm-send-input (&optional for-effect) "Evaluate the Emacs Lisp expression after the prompt." (interactive) - (let (ielm-input) ; set by ielm-input-sender - (comint-send-input) ; update history, markers etc. - (ielm-eval-input ielm-input))) + (let (ielm-input) ; set by ielm-input-sender + (comint-send-input) ; update history, markers etc. + (ielm-eval-input ielm-input for-effect))) ;;; Utility functions @@ -311,16 +318,41 @@ ;;; Evaluation -(defvar ielm-string) -(defvar ielm-form) -(defvar ielm-pos) -(defvar ielm-result) -(defvar ielm-error-type) -(defvar ielm-output) -(defvar ielm-wbuf) -(defvar ielm-pmark) +(defun ielm-standard-output-impl (process) + "Return a function to use for `standard-output' while in ielm eval. +The returned function takes one character as input. Passing nil +to this function instead of a character flushes the output +buffer. Passing t appends a terminating newline if the buffer is +nonempty, then flushes the buffer." + ;; Use an intermediate output buffer because doing redisplay for + ;; each character we output is too expensive. Set up a flush timer + ;; so that users don't have to wait for whole lines to appear before + ;; seeing output. + (let* ((output-buffer nil) + (flush-timer nil) + (flush-buffer + (lambda () + (comint-output-filter + process + (apply #'string (nreverse output-buffer))) + (redisplay) + (setf output-buffer nil) + (when flush-timer + (cancel-timer flush-timer) + (setf flush-timer nil))))) + (lambda (char) + (let (flush-now) + (cond ((and (eq char t) output-buffer) + (push ?\n output-buffer) + (setf flush-now t)) + ((characterp char) + (push char output-buffer))) + (if flush-now + (funcall flush-buffer) + (unless flush-timer + (setf flush-timer (run-with-timer 0.1 nil flush-buffer)))))))) -(defun ielm-eval-input (input-string) +(defun ielm-eval-input (input-string &optional for-effect) "Evaluate the Lisp expression INPUT-STRING, and pretty-print the result." ;; This is the function that actually `sends' the input to the ;; `inferior Lisp process'. All comint-send-input does is works out @@ -331,108 +363,119 @@ ;; this as in output filter that converted sexps in the output ;; stream to their evaluated value. But that would have involved ;; more process coordination than I was happy to deal with. - ;; - ;; NOTE: all temporary variables in this function will be in scope - ;; during the eval, and so need to have non-clashing names. - (let ((ielm-string input-string) ; input expression, as a string - ielm-form ; form to evaluate - ielm-pos ; End posn of parse in string - ielm-result ; Result, or error message - ielm-error-type ; string, nil if no error - (ielm-output "") ; result to display - (ielm-wbuf ielm-working-buffer) ; current buffer after evaluation - (ielm-pmark (ielm-pm))) - (unless (ielm-is-whitespace-or-comment ielm-string) + (let ((string input-string) ; input expression, as a string + form ; form to evaluate + pos ; End posn of parse in string + result ; Result, or error message + error-type ; string, nil if no error + (output "") ; result to display + (wbuf ielm-working-buffer) ; current buffer after evaluation + (pmark (ielm-pm))) + (unless (ielm-is-whitespace-or-comment string) (condition-case err - (let ((rout (read-from-string ielm-string))) - (setq ielm-form (car rout) - ielm-pos (cdr rout))) - (error (setq ielm-result (error-message-string err)) - (setq ielm-error-type "Read error"))) - (unless ielm-error-type - ;; Make sure working buffer has not been killed - (if (not (buffer-name ielm-working-buffer)) - (setq ielm-result "Working buffer has been killed" - ielm-error-type "IELM Error" - ielm-wbuf (current-buffer)) - (if (ielm-is-whitespace-or-comment (substring ielm-string ielm-pos)) - ;; To correctly handle the ielm-local variables *, - ;; ** and ***, we need a temporary buffer to be - ;; current at entry to the inner of the next two let - ;; forms. We need another temporary buffer to exit - ;; that same let. To avoid problems, neither of - ;; these buffers should be alive during the - ;; evaluation of ielm-form. - (let ((*1 *) - (*2 **) - (*3 ***) - ielm-temp-buffer) - (set-match-data ielm-match-data) - (save-excursion - (with-temp-buffer - (condition-case err - (unwind-protect - ;; The next let form creates default - ;; bindings for *, ** and ***. But - ;; these default bindings are - ;; identical to the ielm-local - ;; bindings. Hence, during the - ;; evaluation of ielm-form, the - ;; ielm-local values are going to be - ;; used in all buffers except for - ;; other ielm buffers, which override - ;; them. Normally, the variables *1, - ;; *2 and *3 also have default - ;; bindings, which are not overridden. - (let ((* *1) - (** *2) - (*** *3)) - (kill-buffer (current-buffer)) - (set-buffer ielm-wbuf) - (setq ielm-result - (eval ielm-form lexical-binding)) - (setq ielm-wbuf (current-buffer)) - (setq - ielm-temp-buffer - (generate-new-buffer " *ielm-temp*")) - (set-buffer ielm-temp-buffer)) - (when ielm-temp-buffer - (kill-buffer ielm-temp-buffer))) - (error (setq ielm-result (error-message-string err)) - (setq ielm-error-type "Eval error")) - (quit (setq ielm-result "Quit during evaluation") - (setq ielm-error-type "Eval error"))))) - (setq ielm-match-data (match-data))) - (setq ielm-error-type "IELM error") - (setq ielm-result "More than one sexp in input")))) + (let ((rout (read-from-string string))) + (setq form (car rout) + pos (cdr rout))) + (error (setq result (error-message-string err)) + (setq error-type "Read error"))) + (unless error-type + ;; Make sure working buffer has not been killed + (if (not (buffer-name ielm-working-buffer)) + (setq result "Working buffer has been killed" + error-type "IELM Error" + wbuf (current-buffer)) + (if (ielm-is-whitespace-or-comment (substring string pos)) + ;; To correctly handle the ielm-local variables *, + ;; ** and ***, we need a temporary buffer to be + ;; current at entry to the inner of the next two let + ;; forms. We need another temporary buffer to exit + ;; that same let. To avoid problems, neither of + ;; these buffers should be alive during the + ;; evaluation of form. + (let* ((*1 *) + (*2 **) + (*3 ***) + (active-process (ielm-process)) + (old-standard-output standard-output) + new-standard-output + ielm-temp-buffer) + (set-match-data ielm-match-data) + (save-excursion + (with-temp-buffer + (condition-case err + (unwind-protect + ;; The next let form creates default + ;; bindings for *, ** and ***. But + ;; these default bindings are + ;; identical to the ielm-local + ;; bindings. Hence, during the + ;; evaluation of form, the + ;; ielm-local values are going to be + ;; used in all buffers except for + ;; other ielm buffers, which override + ;; them. Normally, the variables *1, + ;; *2 and *3 also have default + ;; bindings, which are not overridden. + (let ((* *1) + (** *2) + (*** *3)) + (when (eq standard-output t) + (setf new-standard-output + (ielm-standard-output-impl + active-process)) + (setf standard-output new-standard-output)) + (kill-buffer (current-buffer)) + (set-buffer wbuf) + (setq result + (eval form lexical-binding)) + (setq wbuf (current-buffer)) + (setq + ielm-temp-buffer + (generate-new-buffer " *ielm-temp*")) + (set-buffer ielm-temp-buffer)) + (when ielm-temp-buffer + (kill-buffer ielm-temp-buffer)) + (when (eq new-standard-output standard-output) + (ignore-errors + (funcall standard-output t)) + (setf standard-output old-standard-output))) + (error (setq result (error-message-string err)) + (setq error-type "Eval error")) + (quit (setq result "Quit during evaluation") + (setq error-type "Eval error"))))) + (setq ielm-match-data (match-data))) + (setq error-type "IELM error") + (setq result "More than one sexp in input")))) ;; If the eval changed the current buffer, mention it here - (unless (eq ielm-wbuf ielm-working-buffer) - (message "current buffer is now: %s" ielm-wbuf) - (setq ielm-working-buffer ielm-wbuf)) + (unless (eq wbuf ielm-working-buffer) + (message "current buffer is now: %s" wbuf) + (setq ielm-working-buffer wbuf)) - (goto-char ielm-pmark) - (unless ielm-error-type - (condition-case nil - ;; Self-referential objects cause loops in the printer, so - ;; trap quits here. May as well do errors, too - (setq ielm-output (concat ielm-output (pp-to-string ielm-result))) - (error (setq ielm-error-type "IELM Error") - (setq ielm-result "Error during pretty-printing (bug in pp)")) - (quit (setq ielm-error-type "IELM Error") - (setq ielm-result "Quit during pretty-printing")))) - (if ielm-error-type - (progn - (when ielm-noisy (ding)) - (setq ielm-output (concat ielm-output "*** " ielm-error-type " *** ")) - (setq ielm-output (concat ielm-output ielm-result))) - ;; There was no error, so shift the *** values - (setq *** **) - (setq ** *) - (setq * ielm-result)) - (setq ielm-output (concat ielm-output "\n"))) - (setq ielm-output (concat ielm-output ielm-prompt-internal)) - (comint-output-filter (ielm-process) ielm-output))) + (goto-char pmark) + (unless error-type + (condition-case nil + ;; Self-referential objects cause loops in the printer, so + ;; trap quits here. May as well do errors, too + (unless for-effect + (setq output (concat output (pp-to-string result)))) + (error (setq error-type "IELM Error") + (setq result "Error during pretty-printing (bug in pp)")) + (quit (setq error-type "IELM Error") + (setq result "Quit during pretty-printing")))) + (if error-type + (progn + (when ielm-noisy (ding)) + (setq output (concat output "*** " error-type " *** ")) + (setq output (concat output result))) + ;; There was no error, so shift the *** values + (setq *** **) + (setq ** *) + (setq * result)) + (when (or (not for-effect) (not (equal output ""))) + (setq output (concat output "\n")))) + (setq output (concat output ielm-prompt-internal)) + (comint-output-filter (ielm-process) output))) ;;; Process and marker utilities @@ -462,6 +505,11 @@ Inputs longer than one line are moved to the line following the prompt (but see variable `ielm-dynamic-multiline-inputs'). +* \\[ielm-return-for-effect] works like `ielm-return', except + that it doesn't print the result of evaluating the input. This + functionality is useful when forms would generate voluminous + output. + * \\[completion-at-point] completes Lisp symbols (or filenames, within strings), or indents the line if there is nothing to complete. @@ -478,6 +526,13 @@ buffer, then the values in the working buffer are used. The variables `*1', `*2' and `*3', yield the process buffer values. +If, at the start of evaluation, `standard-output' is `t' (the +default), `standard-output' is set to a special function that +causes output to be directed to the ielm buffer. +`standard-output' is restored after evaluation unless explicitly +set to a different value during evaluation. You can use (princ +VALUE) or (pp VALUE) to write to the ielm buffer. + Expressions evaluated by IELM are not subject to `debug-on-quit' or `debug-on-error'. @@ -501,7 +556,7 @@ (setq comint-process-echoes nil) (set (make-local-variable 'completion-at-point-functions) '(ielm-tab comint-replace-by-expanded-history - ielm-complete-filename ielm-complete-symbol)) + ielm-complete-filename ielm-complete-symbol)) (set (make-local-variable 'ielm-prompt-internal) ielm-prompt) (set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only) (setq comint-get-old-input 'ielm-get-old-input) @@ -530,7 +585,7 @@ ;; Was cat, but on non-Unix platforms that might not exist, so ;; use hexl instead, which is part of the Emacs distribution. (condition-case nil - (start-process "ielm" (current-buffer) "hexl") + (start-process "ielm" (current-buffer) "hexl") (file-error (start-process "ielm" (current-buffer) "cat"))) (set-process-query-on-exit-flag (ielm-process) nil) (goto-char (point-max)) @@ -565,13 +620,14 @@ ;;;###autoload (defun ielm nil "Interactively evaluate Emacs Lisp expressions. -Switches to the buffer `*ielm*', or creates it if it does not exist." +Switches to the buffer `*ielm*', or creates it if it does not exist. +See `inferior-emacs-lisp-mode' for details." (interactive) (let (old-point) (unless (comint-check-proc "*ielm*") (with-current-buffer (get-buffer-create "*ielm*") - (unless (zerop (buffer-size)) (setq old-point (point))) - (inferior-emacs-lisp-mode))) + (unless (zerop (buffer-size)) (setq old-point (point))) + (inferior-emacs-lisp-mode))) (switch-to-buffer "*ielm*") (when old-point (push-mark old-point)))) ------------------------------------------------------------ revno: 114701 committer: Michael Albinus branch nick: trunk timestamp: Thu 2013-10-17 21:39:22 +0200 message: Code cleanup. * net/tramp.el (tramp-debug-message): Do not check for connection buffer. (tramp-message): Use "vector" connection property. * net/tramp.el (tramp-rfn-eshadow-update-overlay) (tramp-equal-remote, tramp-eshell-directory-change) * net/tramp-adb.el (tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file) * net/tramp-cmds.el (tramp-list-remote-buffers) (tramp-cleanup-connection, tramp-cleanup-this-connection) * net/tramp-compat.el (tramp-compat-process-running-p) * net/tramp-ftp.el (tramp-ftp-file-name-handler) * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file) (tramp-gvfs-handle-rename-file) * net/tramp-sh.el (tramp-sh-handle-set-file-times) (tramp-set-file-uid-gid) * net/tramp-smb.el (tramp-smb-handle-copy-file) (tramp-smb-handle-rename-file): Use `tramp-tramp-file-p' instead of `file-remote-p'. * net/tramp.el (tramp-connectable-p, tramp-handle-file-remote-p) * net/tramp-gw.el (tramp-gw-gw-proc-sentinel) (tramp-gw-aux-proc-sentinel, tramp-gw-process-filter) (tramp-gw-open-network-stream): Suppress unrelated traces. * net/tramp-adb.el (tramp-adb-maybe-open-connection) * net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch) * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band) * net/tramp-smb.el (tramp-smb-maybe-open-connection): Set "vector" connection property. * net/tramp-cache.el (top): Suppress traces when reading presistency file. * net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch): Refactor common code. Improve debug message. (tramp-maybe-open-connection) * net/tramp-smb.el (tramp-smb-call-winexe): Do not request connection buffer too early. * net/tramp-smb.el (tramp-smb-actions-get-acl): New defconst, renamed from `tramp-smb-actions-with-acl'. (tramp-smb-actions-set-acl): New defconst. (tramp-smb-handle-copy-directory) (tramp-smb-action-get-acl): New defun, renamed from `tramp-smb-action-with-acl'. (tramp-smb-action-set-acl): New defun. (tramp-smb-handle-set-file-acl): Rewrite. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-17 19:31:11 +0000 +++ lisp/ChangeLog 2013-10-17 19:39:22 +0000 @@ -1,3 +1,56 @@ +2013-10-17 Michael Albinus + + Code cleanup. + + * net/tramp.el (tramp-debug-message): Do not check for connection + buffer. + (tramp-message): Use "vector" connection property. + + * net/tramp.el (tramp-rfn-eshadow-update-overlay) + (tramp-equal-remote, tramp-eshell-directory-change) + * net/tramp-adb.el (tramp-adb-handle-copy-file) + (tramp-adb-handle-rename-file) + * net/tramp-cmds.el (tramp-list-remote-buffers) + (tramp-cleanup-connection, tramp-cleanup-this-connection) + * net/tramp-compat.el (tramp-compat-process-running-p) + * net/tramp-ftp.el (tramp-ftp-file-name-handler) + * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file) + (tramp-gvfs-handle-rename-file) + * net/tramp-sh.el (tramp-sh-handle-set-file-times) + (tramp-set-file-uid-gid) + * net/tramp-smb.el (tramp-smb-handle-copy-file) + (tramp-smb-handle-rename-file): Use `tramp-tramp-file-p' instead + of `file-remote-p'. + + * net/tramp.el (tramp-connectable-p, tramp-handle-file-remote-p) + * net/tramp-gw.el (tramp-gw-gw-proc-sentinel) + (tramp-gw-aux-proc-sentinel, tramp-gw-process-filter) + (tramp-gw-open-network-stream): Suppress unrelated traces. + + * net/tramp-adb.el (tramp-adb-maybe-open-connection) + * net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch) + * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band) + * net/tramp-smb.el (tramp-smb-maybe-open-connection): Set "vector" + connection property. + + * net/tramp-cache.el (top): Suppress traces when reading + presistency file. + + * net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch): + Refactor common code. Improve debug message. + (tramp-maybe-open-connection) + * net/tramp-smb.el (tramp-smb-call-winexe): Do not request + connection buffer too early. + + * net/tramp-smb.el (tramp-smb-actions-get-acl): New defconst, renamed + from `tramp-smb-actions-with-acl'. + (tramp-smb-actions-set-acl): New defconst. + (tramp-smb-handle-copy-directory) + (tramp-smb-action-get-acl): New defun, renamed from + `tramp-smb-action-with-acl'. + (tramp-smb-action-set-acl): New defun. + (tramp-smb-handle-set-file-acl): Rewrite. + 2013-10-17 Glenn Morris * indent.el (indent-rigidly): Fix 2013-10-08 change. (Bug#15635) === modified file 'lisp/net/tramp-adb.el' --- lisp/net/tramp-adb.el 2013-09-13 06:03:06 +0000 +++ lisp/net/tramp-adb.el 2013-10-17 19:39:22 +0000 @@ -662,7 +662,8 @@ (if (file-directory-p filename) (tramp-file-name-handler 'copy-directory filename newname keep-date t) (with-tramp-progress-reporter - (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) + (tramp-dissect-file-name + (if (tramp-tramp-file-p filename) filename newname)) 0 (format "Copying %s to %s" filename newname) (let ((tmpfile (file-local-copy filename))) @@ -704,7 +705,7 @@ newname (expand-file-name newname)) (with-parsed-tramp-file-name - (if (file-remote-p filename) filename newname) nil + (if (tramp-tramp-file-p filename) filename newname) nil (with-tramp-progress-reporter v 0 (format "Renaming %s to %s" newname filename) @@ -1134,6 +1135,7 @@ (tramp-adb-wait-for-output p 30) (unless (eq 'run (process-status p)) (tramp-error vec 'file-error "Terminated!")) + (tramp-set-connection-property p "vector" vec) (tramp-compat-set-process-query-on-exit-flag p nil) ;; Check whether the properties have been changed. If === modified file 'lisp/net/tramp-cache.el' --- lisp/net/tramp-cache.el 2013-10-02 13:48:20 +0000 +++ lisp/net/tramp-cache.el 2013-10-17 19:39:22 +0000 @@ -405,6 +405,7 @@ (with-temp-buffer (insert-file-contents tramp-persistency-file-name) (let ((list (read (current-buffer))) + (tramp-verbose 0) element key item) (while (setq element (pop list)) (setq key (pop element)) === modified file 'lisp/net/tramp-cmds.el' --- lisp/net/tramp-cmds.el 2013-10-02 13:48:20 +0000 +++ lisp/net/tramp-cmds.el 2013-10-17 19:39:22 +0000 @@ -48,10 +48,7 @@ nil (mapcar (lambda (x) - (with-current-buffer x - (when (and (stringp default-directory) - (file-remote-p default-directory)) - x))) + (with-current-buffer x (when (tramp-tramp-file-p default-directory) x))) (buffer-list)))) ;;;###tramp-autoload @@ -81,8 +78,7 @@ (completing-read "Enter Tramp connection: " connections nil t (try-completion "" connections))) - (when (and name (file-remote-p name)) - (with-parsed-tramp-file-name name nil v)))) + (and (tramp-tramp-file-p name) (tramp-dissect-file-name name)))) nil nil)) (if (not vec) @@ -113,8 +109,7 @@ (defun tramp-cleanup-this-connection () "Flush all connection related objects of the current buffer's connection." (interactive) - (and (stringp default-directory) - (file-remote-p default-directory) + (and (tramp-tramp-file-p default-directory) (tramp-cleanup-connection (tramp-dissect-file-name default-directory 'noexpand)))) === modified file 'lisp/net/tramp-compat.el' --- lisp/net/tramp-compat.el 2013-09-08 15:04:10 +0000 +++ lisp/net/tramp-compat.el 2013-10-17 19:39:22 +0000 @@ -471,7 +471,7 @@ ;; Fallback, if there is no Lisp support yet. (t (let ((default-directory - (if (file-remote-p default-directory) + (if (tramp-tramp-file-p default-directory) (tramp-compat-temporary-file-directory) default-directory)) (unix95 (getenv "UNIX95")) === modified file 'lisp/net/tramp-ftp.el' --- lisp/net/tramp-ftp.el 2013-08-17 10:20:15 +0000 +++ lisp/net/tramp-ftp.el 2013-10-17 19:39:22 +0000 @@ -172,7 +172,7 @@ ;; We must copy it locally first, because there is no place in ;; ange-ftp for correct handling. ((and (memq operation '(copy-file rename-file)) - (file-remote-p (cadr args)) + (tramp-tramp-file-p (cadr args)) (not (tramp-ftp-file-name-p (cadr args)))) (let* ((filename (car args)) (newname (cadr args)) === modified file 'lisp/net/tramp-gvfs.el' --- lisp/net/tramp-gvfs.el 2013-10-07 12:45:20 +0000 +++ lisp/net/tramp-gvfs.el 2013-10-17 19:39:22 +0000 @@ -630,7 +630,7 @@ nil v 'file-error "Copying failed, see buffer `%s' for details." (buffer-name))))) - (when (file-remote-p newname) + (when (tramp-tramp-file-p newname) (with-parsed-tramp-file-name newname nil (tramp-flush-file-property v (file-name-directory localname)) (tramp-flush-file-property v localname)))))) @@ -938,6 +938,9 @@ (if (not (processp p)) (tramp-error v 'file-notify-error "gvfs-monitor-file failed to start") + (tramp-message + v 6 "Run `%s', %S" (mapconcat 'identity (process-command p) " ") p) + (tramp-set-connection-property p "vector" v) (tramp-compat-set-process-query-on-exit-flag p nil) (set-process-filter p 'tramp-gvfs-file-gvfs-monitor-file-process-filter) (with-current-buffer (process-buffer p) @@ -1061,12 +1064,12 @@ nil v 'file-error "Renaming failed, see buffer `%s' for details." (buffer-name))))) - (when (file-remote-p filename) + (when (tramp-tramp-file-p filename) (with-parsed-tramp-file-name filename nil (tramp-flush-file-property v (file-name-directory localname)) (tramp-flush-file-property v localname))) - (when (file-remote-p newname) + (when (tramp-tramp-file-p newname) (with-parsed-tramp-file-name newname nil (tramp-flush-file-property v (file-name-directory localname)) (tramp-flush-file-property v localname)))))) === modified file 'lisp/net/tramp-gw.el' --- lisp/net/tramp-gw.el 2013-09-08 15:04:10 +0000 +++ lisp/net/tramp-gw.el 2013-10-17 19:39:22 +0000 @@ -96,7 +96,7 @@ (unless (memq (process-status proc) '(run open)) (tramp-message tramp-gw-vector 4 "Deleting auxiliary process `%s'" tramp-gw-gw-proc) - (let* (tramp-verbose + (let* ((tramp-verbose 0) (p (tramp-get-connection-property proc "process" nil))) (when (processp p) (delete-process p))))) @@ -111,7 +111,7 @@ (tramp-compat-set-process-query-on-exit-flag proc nil) ;; We don't want debug messages, because the corresponding debug ;; buffer might be undecided. - (let (tramp-verbose) + (let ((tramp-verbose 0)) (tramp-set-connection-property tramp-gw-gw-proc "process" proc) (tramp-set-connection-property proc "process" tramp-gw-gw-proc)) ;; Set the process-filter functions for both processes. @@ -125,7 +125,7 @@ (tramp-gw-process-filter tramp-gw-gw-proc s)))))) (defun tramp-gw-process-filter (proc string) - (let (tramp-verbose) + (let ((tramp-verbose 0)) (process-send-string (tramp-get-connection-property proc "process" nil) string))) @@ -245,7 +245,7 @@ ;; proxies have a timeout of 60". We wait 65" in order to ;; receive an answer this case. (ignore-errors - (let (tramp-verbose) + (let ((tramp-verbose 0)) (tramp-wait-for-regexp proc 65 "\r?\n\r?\n"))) ;; Check return code. (goto-char (point-min)) === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2013-10-07 12:45:20 +0000 +++ lisp/net/tramp-sh.el 2013-10-17 19:39:22 +0000 @@ -1300,7 +1300,7 @@ (defun tramp-sh-handle-set-file-times (filename &optional time) "Like `set-file-times' for Tramp files." - (if (file-remote-p filename) + (if (tramp-tramp-file-p filename) (with-parsed-tramp-file-name filename nil (tramp-flush-file-property v localname) (let ((time (if (or (null time) (equal time '(0 0))) @@ -1339,7 +1339,7 @@ ;; the majority of cases. ;; Don't modify `last-coding-system-used' by accident. (let ((last-coding-system-used last-coding-system-used)) - (if (file-remote-p filename) + (if (tramp-tramp-file-p filename) (with-parsed-tramp-file-name filename nil (if (and (zerop (user-uid)) (tramp-local-host-p v)) ;; If we are root on the local host, we can do it directly. @@ -2323,6 +2323,7 @@ (tramp-message orig-vec 6 "%s" (mapconcat 'identity (process-command p) " ")) + (tramp-set-connection-property p "vector" orig-vec) (tramp-compat-set-process-query-on-exit-flag p nil) (tramp-process-actions p v nil tramp-actions-copy-out-of-band) @@ -2333,7 +2334,8 @@ (re-search-backward "tramp_exit_status [0-9]+" nil t) (tramp-error orig-vec 'file-error - "Couldn't find exit status of `%s'" (process-command p))) + "Couldn't find exit status of `%s'" + (mapconcat 'identity (process-command p) " "))) (skip-chars-forward "^ ") (unless (zerop (read (current-buffer))) (forward-line -1) @@ -3342,14 +3344,12 @@ (setq file-name (expand-file-name file-name)) (with-parsed-tramp-file-name file-name nil (let* ((default-directory (file-name-directory file-name)) - command events filter p) + command events filter p sequence) (cond ;; gvfs-monitor-dir. ((setq command (tramp-get-remote-gvfs-monitor-dir v)) (setq filter 'tramp-sh-file-gvfs-monitor-dir-process-filter - p (start-file-process - "gvfs-monitor-dir" (generate-new-buffer " *gvfs-monitor-dir*") - command localname))) + sequence `(,command ,localname))) ;; inotifywait. ((setq command (tramp-get-remote-inotifywait v)) (setq filter 'tramp-sh-file-inotifywait-process-filter @@ -3359,18 +3359,27 @@ "create,modify,move,delete,attrib") ((memq 'change flags) "create,modify,move,delete") ((memq 'attribute-change flags) "attrib")) - p (start-file-process - "inotifywait" (generate-new-buffer " *inotifywait*") - command "-mq" "-e" events localname))) + sequence `(,command "-mq" "-e" ,events ,localname))) ;; None. (t (tramp-error v 'file-notify-error "No file notification program found on %s" (file-remote-p file-name)))) + ;; Start process. + (setq p (apply + 'start-file-process + (file-name-nondirectory command) + (generate-new-buffer + (format " *%s*" (file-name-nondirectory command))) + sequence)) ;; Return the process object as watch-descriptor. (if (not (processp p)) (tramp-error - v 'file-notify-error "`%s' failed to start on remote host" command) + v 'file-notify-error + "`%s' failed to start on remote host" + (mapconcat 'identity sequence " ")) + (tramp-message v 6 "Run `%s', %S" (mapconcat 'identity sequence " ") p) + (tramp-set-connection-property p "vector" v) (tramp-compat-set-process-query-on-exit-flag p nil) (set-process-filter p filter) p)))) @@ -4333,10 +4342,6 @@ (condition-case err (unless (and p (processp p) (memq (process-status p) '(run open))) - ;; We call `tramp-get-buffer' in order to get a debug buffer - ;; for messages from the beginning. - (tramp-get-buffer vec) - ;; If `non-essential' is non-nil, don't reopen a new connection. (when (and (boundp 'non-essential) (symbol-value 'non-essential)) (throw 'non-essential 'non-essential)) === modified file 'lisp/net/tramp-smb.el' --- lisp/net/tramp-smb.el 2013-10-16 13:16:53 +0000 +++ lisp/net/tramp-smb.el 2013-10-17 19:39:22 +0000 @@ -187,11 +187,21 @@ See `tramp-actions-before-shell' for more info.") -(defconst tramp-smb-actions-with-acl - '((tramp-password-prompt-regexp tramp-action-password) - (tramp-wrong-passwd-regexp tramp-action-permission-denied) - (tramp-smb-errors tramp-action-permission-denied) - (tramp-process-alive-regexp tramp-smb-action-with-acl)) +(defconst tramp-smb-actions-get-acl + '((tramp-password-prompt-regexp tramp-action-password) + (tramp-wrong-passwd-regexp tramp-action-permission-denied) + (tramp-smb-errors tramp-action-permission-denied) + (tramp-process-alive-regexp tramp-smb-action-get-acl)) + "List of pattern/action pairs. +This list is used for smbcacls actions. + +See `tramp-actions-before-shell' for more info.") + +(defconst tramp-smb-actions-set-acl + '((tramp-password-prompt-regexp tramp-action-password) + (tramp-wrong-passwd-regexp tramp-action-permission-denied) + (tramp-smb-errors tramp-action-permission-denied) + (tramp-process-alive-regexp tramp-smb-action-set-acl)) "List of pattern/action pairs. This list is used for smbcacls actions. @@ -481,6 +491,7 @@ (tramp-message v 6 "%s" (mapconcat 'identity (process-command p) " ")) + (tramp-set-connection-property p "vector" v) (tramp-compat-set-process-query-on-exit-flag p nil) (tramp-process-actions p v nil tramp-smb-actions-with-tar) @@ -521,7 +532,8 @@ (setq filename (expand-file-name filename) newname (expand-file-name newname)) (with-tramp-progress-reporter - (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) + (tramp-dissect-file-name + (if (tramp-tramp-file-p filename) filename newname)) 0 (format "Copying %s to %s" filename newname) (if (file-directory-p filename) @@ -667,7 +679,7 @@ method user host (tramp-run-real-handler 'expand-file-name (list localname)))))) -(defun tramp-smb-action-with-acl (proc vec) +(defun tramp-smb-action-get-acl (proc vec) "Read ACL data from connection buffer." (when (not (memq (process-status proc) '(run open))) ;; Accept pending output. @@ -734,9 +746,9 @@ (tramp-message v 6 "%s" (mapconcat 'identity (process-command p) " ")) + (tramp-set-connection-property p "vector" v) (tramp-compat-set-process-query-on-exit-flag p nil) - (tramp-process-actions p v nil tramp-smb-actions-with-acl) - (tramp-message v 6 "\n%s" (buffer-string)) + (tramp-process-actions p v nil tramp-smb-actions-get-acl) (when (> (point-max) (point-min)) (tramp-compat-funcall 'substring-no-properties (buffer-string))))) @@ -1225,11 +1237,12 @@ (file-exists-p newname)) (tramp-error (tramp-dissect-file-name - (if (file-remote-p filename) filename newname)) + (if (tramp-tramp-file-p filename) filename newname)) 'file-already-exists newname)) (with-tramp-progress-reporter - (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) + (tramp-dissect-file-name + (if (tramp-tramp-file-p filename) filename newname)) 0 (format "Renaming %s to %s" filename newname) (if (and (not (file-exists-p newname)) @@ -1260,67 +1273,85 @@ (tramp-compat-delete-directory filename 'recursive) (delete-file filename))))) +(defun tramp-smb-action-set-acl (proc vec) + "Read ACL data from connection buffer." + (when (not (memq (process-status proc) '(run open))) + ;; Accept pending output. + (while (tramp-accept-process-output proc 0.1)) + (with-current-buffer (tramp-get-connection-buffer vec) + (tramp-message vec 10 "\n%s" (buffer-string)) + (throw 'tramp-action 'ok)))) + (defun tramp-smb-handle-set-file-acl (filename acl-string) "Like `set-file-acl' for Tramp files." - (with-parsed-tramp-file-name filename nil - (when (and (stringp acl-string) (executable-find tramp-smb-acl-program)) - - (setq tramp-current-method (tramp-file-name-method v) - tramp-current-user (tramp-file-name-user v) - tramp-current-host (tramp-file-name-real-host v)) - (tramp-set-file-property v localname "file-acl" 'undef) - - (let* ((real-user (tramp-file-name-real-user v)) - (real-host (tramp-file-name-real-host v)) - (domain (tramp-file-name-domain v)) - (port (tramp-file-name-port v)) - (share (tramp-smb-get-share v)) - (localname (tramp-compat-replace-regexp-in-string - "\\\\" "/" (tramp-smb-get-localname v))) - (args (list (concat "//" real-host "/" share) "-E" "-S" - (tramp-compat-replace-regexp-in-string - "\n" "," acl-string)))) - - (if (not (zerop (length real-user))) - (setq args (append args (list "-U" real-user))) - (setq args (append args (list "-N")))) - - (when domain (setq args (append args (list "-W" domain)))) - (when port (setq args (append args (list "-p" port)))) - (when tramp-smb-conf - (setq args (append args (list "-s" tramp-smb-conf)))) - (setq - args - (append args (list (shell-quote-argument localname) "2>/dev/null"))) - - (unwind-protect - (with-temp-buffer - ;; Set the transfer process properties. - (tramp-set-connection-property - v "process-name" (buffer-name (current-buffer))) - (tramp-set-connection-property - v "process-buffer" (current-buffer)) - - ;; Use an asynchronous processes. By this, password can - ;; be handled. - (let ((p (apply - 'start-process - (tramp-get-connection-name v) - (tramp-get-connection-buffer v) - tramp-smb-acl-program args))) - - (tramp-message - v 6 "%s" (mapconcat 'identity (process-command p) " ")) - (tramp-compat-set-process-query-on-exit-flag p nil) - (tramp-process-actions p v nil tramp-smb-actions-with-acl) - (tramp-message v 6 "\n%s" (buffer-string)) - ;; Success. - (tramp-set-file-property v localname "file-acl" acl-string) - t)) - - ;; Reset the transfer process properties. - (tramp-set-connection-property v "process-name" nil) - (tramp-set-connection-property v "process-buffer" nil)))))) + (ignore-errors + (with-parsed-tramp-file-name filename nil + (when (and (stringp acl-string) (executable-find tramp-smb-acl-program)) + (setq tramp-current-method (tramp-file-name-method v) + tramp-current-user (tramp-file-name-user v) + tramp-current-host (tramp-file-name-real-host v)) + (tramp-set-file-property v localname "file-acl" 'undef) + + (let* ((real-user (tramp-file-name-real-user v)) + (real-host (tramp-file-name-real-host v)) + (domain (tramp-file-name-domain v)) + (port (tramp-file-name-port v)) + (share (tramp-smb-get-share v)) + (localname (tramp-compat-replace-regexp-in-string + "\\\\" "/" (tramp-smb-get-localname v))) + (args (list (concat "//" real-host "/" share) "-E" "-S" + (tramp-compat-replace-regexp-in-string + "\n" "," acl-string)))) + + (if (not (zerop (length real-user))) + (setq args (append args (list "-U" real-user))) + (setq args (append args (list "-N")))) + + (when domain (setq args (append args (list "-W" domain)))) + (when port (setq args (append args (list "-p" port)))) + (when tramp-smb-conf + (setq args (append args (list "-s" tramp-smb-conf)))) + (setq + args + (append args (list (shell-quote-argument localname) + "&&" "echo" "tramp_exit_status" "0" + "||" "echo" "tramp_exit_status" "1"))) + + (unwind-protect + (with-temp-buffer + ;; Set the transfer process properties. + (tramp-set-connection-property + v "process-name" (buffer-name (current-buffer))) + (tramp-set-connection-property + v "process-buffer" (current-buffer)) + + ;; Use an asynchronous processes. By this, password can + ;; be handled. + (let ((p (apply + 'start-process-shell-command + (tramp-get-connection-name v) + (tramp-get-connection-buffer v) + tramp-smb-acl-program args))) + + (tramp-message + v 6 "%s" (mapconcat 'identity (process-command p) " ")) + (tramp-set-connection-property p "vector" v) + (tramp-compat-set-process-query-on-exit-flag p nil) + (tramp-process-actions p v nil tramp-smb-actions-set-acl) + (goto-char (point-max)) + (unless (re-search-backward "tramp_exit_status [0-9]+" nil t) + (tramp-error + v 'file-error + "Couldn't find exit status of `%s'" tramp-smb-acl-program)) + (skip-chars-forward "^ ") + (when (zerop (read (current-buffer))) + ;; Success. + (tramp-set-file-property v localname "file-acl" acl-string) + t))) + + ;; Reset the transfer process properties. + (tramp-set-connection-property v "process-name" nil) + (tramp-set-connection-property v "process-buffer" nil))))))) (defun tramp-smb-handle-set-file-modes (filename mode) "Like `set-file-modes' for Tramp files." @@ -1819,6 +1850,7 @@ (tramp-message vec 6 "%s" (mapconcat 'identity (process-command p) " ")) + (tramp-set-connection-property p "vector" vec) (tramp-compat-set-process-query-on-exit-flag p nil) ;; Set variables for computing the prompt for reading password. @@ -1936,10 +1968,6 @@ (defun tramp-smb-call-winexe (vec) "Apply a remote command, if possible, using `tramp-smb-winexe-program'." - ;; We call `tramp-get-buffer' in order to get a debug buffer for - ;; messages. - (tramp-get-buffer vec) - ;; Check for program. (unless (executable-find tramp-smb-winexe-program) (tramp-error === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2013-10-07 12:45:20 +0000 +++ lisp/net/tramp.el 2013-10-17 19:39:22 +0000 @@ -1433,67 +1433,65 @@ "Append message to debug buffer. Message is formatted with FMT-STRING as control string and the remaining ARGUMENTS to actually emit the message (if applicable)." - (when (get-buffer (tramp-buffer-name vec)) - (with-current-buffer (tramp-get-debug-buffer vec) - (goto-char (point-max)) - ;; Headline. - (when (bobp) - (insert - (format - ";; %sEmacs: %s Tramp: %s -*- mode: outline; -*-" - (if (featurep 'sxemacs) "SX" (if (featurep 'xemacs) "X" "GNU ")) - emacs-version tramp-version))) - (unless (bolp) - (insert "\n")) - ;; Timestamp. - (let ((now (current-time))) - (insert (format-time-string "%T." now)) - (insert (format "%06d " (nth 2 now)))) - ;; Calling Tramp function. We suppress compat and trace - ;; functions from being displayed. - (let ((btn 1) btf fn) - (while (not fn) - (setq btf (nth 1 (backtrace-frame btn))) - (if (not btf) - (setq fn "") - (when (symbolp btf) - (setq fn (symbol-name btf)) - (unless - (and - (string-match "^tramp" fn) - (not - (string-match - (concat - "^" - (regexp-opt - '("tramp-backtrace" - "tramp-compat-condition-case-unless-debug" - "tramp-compat-funcall" - "tramp-compat-with-temp-message" - "tramp-condition-case-unless-debug" - "tramp-debug-message" - "tramp-error" - "tramp-error-with-buffer" - "tramp-message" - "tramp-user-error") - t) - "$") - fn))) - (setq fn nil))) - (setq btn (1+ btn)))) - ;; The following code inserts filename and line number. - ;; Should be inactive by default, because it is time - ;; consuming. -; (let ((ffn (find-function-noselect (intern fn)))) -; (insert -; (format -; "%s:%d: " -; (file-name-nondirectory (buffer-file-name (car ffn))) -; (with-current-buffer (car ffn) -; (1+ (count-lines (point-min) (cdr ffn))))))) - (insert (format "%s " fn))) - ;; The message. - (insert (apply 'format fmt-string arguments))))) + (with-current-buffer (tramp-get-debug-buffer vec) + (goto-char (point-max)) + ;; Headline. + (when (bobp) + (insert + (format + ";; %sEmacs: %s Tramp: %s -*- mode: outline; -*-" + (if (featurep 'sxemacs) "SX" (if (featurep 'xemacs) "X" "GNU ")) + emacs-version tramp-version))) + (unless (bolp) + (insert "\n")) + ;; Timestamp. + (let ((now (current-time))) + (insert (format-time-string "%T." now)) + (insert (format "%06d " (nth 2 now)))) + ;; Calling Tramp function. We suppress compat and trace functions + ;; from being displayed. + (let ((btn 1) btf fn) + (while (not fn) + (setq btf (nth 1 (backtrace-frame btn))) + (if (not btf) + (setq fn "") + (when (symbolp btf) + (setq fn (symbol-name btf)) + (unless + (and + (string-match "^tramp" fn) + (not + (string-match + (concat + "^" + (regexp-opt + '("tramp-backtrace" + "tramp-compat-condition-case-unless-debug" + "tramp-compat-funcall" + "tramp-compat-with-temp-message" + "tramp-condition-case-unless-debug" + "tramp-debug-message" + "tramp-error" + "tramp-error-with-buffer" + "tramp-message" + "tramp-user-error") + t) + "$") + fn))) + (setq fn nil))) + (setq btn (1+ btn)))) + ;; The following code inserts filename and line number. Should + ;; be inactive by default, because it is time consuming. +; (let ((ffn (find-function-noselect (intern fn)))) +; (insert +; (format +; "%s:%d: " +; (file-name-nondirectory (buffer-file-name (car ffn))) +; (with-current-buffer (car ffn) +; (1+ (count-lines (point-min) (cdr ffn))))))) + (insert (format "%s " fn))) + ;; The message. + (insert (apply 'format fmt-string arguments)))) (defvar tramp-message-show-message t "Show Tramp message in the minibuffer. @@ -1530,13 +1528,13 @@ arguments)) ;; Log only when there is a minimum level. (when (>= tramp-verbose 4) - (when (and vec-or-proc - (processp vec-or-proc) - (buffer-name (process-buffer vec-or-proc))) - (with-current-buffer (process-buffer vec-or-proc) - ;; Translate proc to vec. - (setq vec-or-proc (tramp-dissect-file-name default-directory)))) - (when (and vec-or-proc (vectorp vec-or-proc)) + ;; Translate proc to vec. + (when (processp vec-or-proc) + (let ((tramp-verbose 0)) + (setq vec-or-proc + (tramp-get-connection-property vec-or-proc "vector" nil)))) + ;; Do it. + (when (vectorp vec-or-proc) (apply 'tramp-debug-message vec-or-proc (concat (format "(%d) # " level) fmt-string) @@ -1548,7 +1546,7 @@ function is meant for debugging purposes." (if vec-or-proc (tramp-message vec-or-proc 10 "\n%s" (with-output-to-string (backtrace))) - (if (<= 10 tramp-verbose) + (if (>= tramp-verbose 10) (with-output-to-temp-buffer "*debug tramp*" (backtrace))))) (defsubst tramp-error (vec-or-proc signal fmt-string &rest arguments) @@ -1821,7 +1819,7 @@ ;; We do not want to send any remote command. (non-essential t)) (when - (file-remote-p + (tramp-tramp-file-p (tramp-compat-funcall 'buffer-substring-no-properties end (point-max))) (save-excursion @@ -2356,7 +2354,8 @@ (and (tramp-tramp-file-p filename) (with-parsed-tramp-file-name filename nil (or (not (tramp-completion-mode-p)) - (let ((p (tramp-get-connection-process v))) + (let* ((tramp-verbose 0) + (p (tramp-get-connection-process v))) (and p (processp p) (memq (process-status p) '(run open)))))))) ;; Method, host name and user name completion. @@ -2934,7 +2933,8 @@ (defun tramp-handle-file-remote-p (filename &optional identification connected) "Like `file-remote-p' for Tramp files." - (let ((tramp-verbose 3)) + ;; We do not want traces in the debug buffer. + (let ((tramp-verbose (min tramp-verbose 3))) (when (tramp-tramp-file-p filename) (let* ((v (tramp-dissect-file-name filename)) (p (tramp-get-connection-process v)) @@ -3663,8 +3663,8 @@ would yield `t'. On the other hand, the following check results in nil: (tramp-equal-remote \"/sudo::/etc\" \"/su::/etc\")" - (and (stringp (file-remote-p file1)) - (stringp (file-remote-p file2)) + (and (tramp-tramp-file-p file1) + (tramp-tramp-file-p file2) (string-equal (file-remote-p file1) (file-remote-p file2)))) ;;;###tramp-autoload @@ -4198,7 +4198,7 @@ (defun tramp-eshell-directory-change () "Set `eshell-path-env' to $PATH of the host related to `default-directory'." (setq eshell-path-env - (if (file-remote-p default-directory) + (if (tramp-tramp-file-p default-directory) (with-parsed-tramp-file-name default-directory nil (mapconcat 'identity ------------------------------------------------------------ revno: 114700 fixes bug: http://debbugs.gnu.org/15635 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-10-17 15:31:11 -0400 message: * lisp/indent.el (indent-rigidly): Fix 2013-10-08 change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-17 04:51:05 +0000 +++ lisp/ChangeLog 2013-10-17 19:31:11 +0000 @@ -1,3 +1,7 @@ +2013-10-17 Glenn Morris + + * indent.el (indent-rigidly): Fix 2013-10-08 change. (Bug#15635) + 2013-10-17 Stefan Monnier * skeleton.el (skeleton-newline): Remove. === modified file 'lisp/indent.el' --- lisp/indent.el 2013-10-08 06:17:49 +0000 +++ lisp/indent.el 2013-10-17 19:31:11 +0000 @@ -212,7 +212,7 @@ (skip-chars-forward " \t") (setq eol-flag (eolp))) (or eol-flag - (indent-to (max 0 (+ indent arg)) 0)) + (indent-to (max 0 (+ indent (prefix-numeric-value arg))) 0)) (delete-region (point) (progn (skip-chars-forward " \t") (point)))) (forward-line 1)) (move-marker end nil)))) ------------------------------------------------------------ revno: 114699 committer: Xue Fuqiao branch nick: trunk timestamp: Thu 2013-10-17 21:56:37 +0800 message: Continuation of previous change. diff: === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2013-10-17 13:46:44 +0000 +++ doc/lispref/display.texi 2013-10-17 13:56:37 +0000 @@ -1795,7 +1795,7 @@ @var{string} extends across the column @var{start-column}. If @var{ellipsis} is non-@code{nil}, it should be a string which will -replace the end of @var{str} (including any padding) if it extends +replace the end of @var{string} (including any padding) if it extends beyond @var{width}, unless the display width of @var{string} is equal to or less than the display width of @var{ellipsis}. If @var{ellipsis} is non-@code{nil} and not a string, it stands for ------------------------------------------------------------ revno: 114698 committer: Xue Fuqiao branch nick: trunk timestamp: Thu 2013-10-17 21:46:44 +0800 message: * doc/lispref/display.texi (Width): Fix arguments of ‘truncate-string-to-width’. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-10-16 13:46:01 +0000 +++ doc/lispref/ChangeLog 2013-10-17 13:46:44 +0000 @@ -1,3 +1,7 @@ +2013-10-17 Xue Fuqiao + + * display.texi (Width): Fix arguments of ‘truncate-string-to-width’. + 2013-10-16 Xue Fuqiao * display.texi (Selective Display): Add an index for explicit === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2013-10-17 11:43:40 +0000 +++ doc/lispref/display.texi 2013-10-17 13:46:44 +0000 @@ -1796,8 +1796,8 @@ If @var{ellipsis} is non-@code{nil}, it should be a string which will replace the end of @var{str} (including any padding) if it extends -beyond @var{end-column}, unless the display width of @var{str} is -equal to or less than the display width of @var{ellipsis}. If +beyond @var{width}, unless the display width of @var{string} is equal +to or less than the display width of @var{ellipsis}. If @var{ellipsis} is non-@code{nil} and not a string, it stands for @code{"..."}. ------------------------------------------------------------ revno: 114697 committer: Xue Fuqiao branch nick: trunk timestamp: Thu 2013-10-17 19:43:40 +0800 message: Trivial doc fix. diff: === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2013-10-16 13:46:01 +0000 +++ doc/lispref/display.texi 2013-10-17 11:43:40 +0000 @@ -1126,6 +1126,7 @@ @result{} # ---------- Buffer: foo ---------- + 20 # ------------------------------------------------------------ revno: 114696 author: Paul Eggert committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-10-16 23:42:21 -0700 message: Make some functions static in non-Microsoft builds. On my platform (Fedora 19 x86-64), this shrinks the Emacs executable (text+data) by 0.25%. * dispextern.h (erase_phys_cursor) [!WINDOWSNT]: (load_color) [!MSDOS]: * gnutls.h (emacs_gnutls_transport_set_errno) [!WINDOWSNT]: * keyboard.h (make_ctrl_char) [!WINDOWSNT]: * lisp.h (check_existing): * process.h (conv_sockaddr_to_lisp, network_interface_list) (network_interface_info) [!WINDOWSNT]: * termhooks.h (encode_terminal_code) [!WINDOWSNT]: Remove extern decls. * fileio.c (check_existing): * keyboard.c (make_ctrl_char) [!WINDOWSNT]: * process.c (conv_sockaddr_to_lisp, network_interface_list) (network_interface_info) [!WINDOWSNT]: * term.c (encode_terminal_code) [!WINDOWSNT]: * xdisp.c (erase_phys_cursor) [!WINDOWSNT]: * xfaces.c (load_color) [!MSDOS]: Now static. * fileio.c (check_existing, check_executable, check_writable): * process.c (network_interface_list, network_interface_info): Move earlier, so that we don't need forward decls. * gnutls.c (fn_gnutls_transport_set_errno) (emacs_gnutls_transport_set_errno) [!WINDOWNT]: Remove; unused. * w32.c (init_environment): Use faccessat rather than check_existing, partly for consistency with the rest of the code in this file, partly so that check_existing can be static. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-17 03:08:59 +0000 +++ src/ChangeLog 2013-10-17 06:42:21 +0000 @@ -1,5 +1,35 @@ 2013-10-17 Paul Eggert + Make some functions static in non-Microsoft builds. + On my platform (Fedora 19 x86-64), this shrinks the + Emacs executable (text+data) by 0.25%. + * dispextern.h (erase_phys_cursor) [!WINDOWSNT]: + (load_color) [!MSDOS]: + * gnutls.h (emacs_gnutls_transport_set_errno) [!WINDOWSNT]: + * keyboard.h (make_ctrl_char) [!WINDOWSNT]: + * lisp.h (check_existing): + * process.h (conv_sockaddr_to_lisp, network_interface_list) + (network_interface_info) [!WINDOWSNT]: + * termhooks.h (encode_terminal_code) [!WINDOWSNT]: + Remove extern decls. + * fileio.c (check_existing): + * keyboard.c (make_ctrl_char) [!WINDOWSNT]: + * process.c (conv_sockaddr_to_lisp, network_interface_list) + (network_interface_info) [!WINDOWSNT]: + * term.c (encode_terminal_code) [!WINDOWSNT]: + * xdisp.c (erase_phys_cursor) [!WINDOWSNT]: + * xfaces.c (load_color) [!MSDOS]: + Now static. + * fileio.c (check_existing, check_executable, check_writable): + * process.c (network_interface_list, network_interface_info): + Move earlier, so that we don't need forward decls. + * gnutls.c (fn_gnutls_transport_set_errno) + (emacs_gnutls_transport_set_errno) [!WINDOWNT]: + Remove; unused. + * w32.c (init_environment): Use faccessat rather than + check_existing, partly for consistency with the rest of the code + in this file, partly so that check_existing can be static. + Make VALMASK visible to GDB even if clang is used (Bug#15574). * emacs.c (MAIN_PROGRAM): New macro. * lisp.h (DEFINE_GDB_SYMBOL_BEGIN, DEFINE_GDB_SYMBOL_END): New macros. === modified file 'src/dispextern.h' --- src/dispextern.h 2013-10-11 15:42:06 +0000 +++ src/dispextern.h 2013-10-17 06:42:21 +0000 @@ -3229,7 +3229,9 @@ enum draw_glyphs_face); extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, struct glyph *, int *, int *, int *); +#ifdef WINDOWSNT extern void erase_phys_cursor (struct window *); +#endif extern void display_and_set_cursor (struct window *, bool, int, int, int, int); extern void x_update_cursor (struct frame *, bool); extern void x_clear_cursor (struct window *); @@ -3343,8 +3345,10 @@ Lisp_Object); Lisp_Object tty_color_name (struct frame *, int); void clear_face_cache (int); +#ifdef MSDOS unsigned long load_color (struct frame *, struct face *, Lisp_Object, enum lface_attribute_index); +#endif void unload_color (struct frame *, unsigned long); char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, int *); === modified file 'src/fileio.c' --- src/fileio.c 2013-10-10 21:42:38 +0000 +++ src/fileio.c 2013-10-17 06:42:21 +0000 @@ -161,6 +161,56 @@ struct coding_system *); +/* Return true if FILENAME exists. */ + +static bool +check_existing (const char *filename) +{ + return faccessat (AT_FDCWD, filename, F_OK, AT_EACCESS) == 0; +} + +/* Return true if file FILENAME exists and can be executed. */ + +static bool +check_executable (char *filename) +{ + return faccessat (AT_FDCWD, filename, X_OK, AT_EACCESS) == 0; +} + +/* Return true if file FILENAME exists and can be accessed + according to AMODE, which should include W_OK. + On failure, return false and set errno. */ + +static bool +check_writable (const char *filename, int amode) +{ +#ifdef MSDOS + /* FIXME: an faccessat implementation should be added to the + DOS/Windows ports and this #ifdef branch should be removed. */ + struct stat st; + if (stat (filename, &st) < 0) + return 0; + errno = EPERM; + return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode)); +#else /* not MSDOS */ + bool res = faccessat (AT_FDCWD, filename, amode, AT_EACCESS) == 0; +#ifdef CYGWIN + /* faccessat may have returned failure because Cygwin couldn't + determine the file's UID or GID; if so, we return success. */ + if (!res) + { + int faccessat_errno = errno; + struct stat st; + if (stat (filename, &st) < 0) + return 0; + res = (st.st_uid == -1 || st.st_gid == -1); + errno = faccessat_errno; + } +#endif /* CYGWIN */ + return res; +#endif /* not MSDOS */ +} + /* Signal a file-access failure. STRING describes the failure, NAME the file involved, and ERRORNO the errno value. @@ -1733,7 +1783,7 @@ xnm = SSDATA (filename); x = xnm + SBYTES (filename); - + /* If /~ or // appears, discard everything through first slash. */ while ((p = search_embedded_absfilename (xnm, x)) != NULL) /* This time we do not start over because we've already expanded envvars @@ -2440,55 +2490,6 @@ return file_name_absolute_p (SSDATA (filename)) ? Qt : Qnil; } -/* Return true if FILENAME exists. */ -bool -check_existing (const char *filename) -{ - return faccessat (AT_FDCWD, filename, F_OK, AT_EACCESS) == 0; -} - -/* Return true if file FILENAME exists and can be executed. */ - -static bool -check_executable (char *filename) -{ - return faccessat (AT_FDCWD, filename, X_OK, AT_EACCESS) == 0; -} - -/* Return true if file FILENAME exists and can be accessed - according to AMODE, which should include W_OK. - On failure, return false and set errno. */ - -static bool -check_writable (const char *filename, int amode) -{ -#ifdef MSDOS - /* FIXME: an faccessat implementation should be added to the - DOS/Windows ports and this #ifdef branch should be removed. */ - struct stat st; - if (stat (filename, &st) < 0) - return 0; - errno = EPERM; - return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode)); -#else /* not MSDOS */ - bool res = faccessat (AT_FDCWD, filename, amode, AT_EACCESS) == 0; -#ifdef CYGWIN - /* faccessat may have returned failure because Cygwin couldn't - determine the file's UID or GID; if so, we return success. */ - if (!res) - { - int faccessat_errno = errno; - struct stat st; - if (stat (filename, &st) < 0) - return 0; - res = (st.st_uid == -1 || st.st_gid == -1); - errno = faccessat_errno; - } -#endif /* CYGWIN */ - return res; -#endif /* not MSDOS */ -} - DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0, doc: /* Return t if file FILENAME exists (whether or not you can read it.) See also `file-readable-p' and `file-attributes'. @@ -2514,7 +2515,7 @@ absname = ENCODE_FILE (absname); - return (check_existing (SSDATA (absname))) ? Qt : Qnil; + return check_existing (SSDATA (absname)) ? Qt : Qnil; } DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0, === modified file 'src/gnutls.c' --- src/gnutls.c 2013-10-11 13:47:35 +0000 +++ src/gnutls.c 2013-10-17 06:42:21 +0000 @@ -249,7 +249,9 @@ #define fn_gnutls_record_recv gnutls_record_recv #define fn_gnutls_record_send gnutls_record_send #define fn_gnutls_strerror gnutls_strerror +#ifdef WINDOWSNT #define fn_gnutls_transport_set_errno gnutls_transport_set_errno +#endif #define fn_gnutls_transport_set_ptr2 gnutls_transport_set_ptr2 #define fn_gnutls_x509_crt_check_hostname gnutls_x509_crt_check_hostname #define fn_gnutls_x509_crt_deinit gnutls_x509_crt_deinit @@ -364,11 +366,13 @@ return fn_gnutls_record_check_pending (state); } +#ifdef WINDOWSNT void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) { fn_gnutls_transport_set_errno (state, err); } +#endif ptrdiff_t emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) === modified file 'src/gnutls.h' --- src/gnutls.h 2013-07-10 23:23:57 +0000 +++ src/gnutls.h 2013-10-17 06:42:21 +0000 @@ -64,7 +64,9 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte); extern int emacs_gnutls_record_check_pending (gnutls_session_t state); +#ifdef WINDOWSNT extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err); +#endif extern Lisp_Object emacs_gnutls_deinit (Lisp_Object); extern void syms_of_gnutls (void); === modified file 'src/keyboard.c' --- src/keyboard.c 2013-10-15 13:57:37 +0000 +++ src/keyboard.c 2013-10-17 06:42:21 +0000 @@ -2097,6 +2097,9 @@ /* Apply the control modifier to CHARACTER. */ +#ifndef WINDOWSNT +static +#endif int make_ctrl_char (int c) { === modified file 'src/keyboard.h' --- src/keyboard.h 2013-10-15 13:57:37 +0000 +++ src/keyboard.h 2013-10-17 06:42:21 +0000 @@ -517,7 +517,9 @@ extern void clear_input_pending (void); extern bool requeued_events_pending_p (void); extern void bind_polling_period (int); +#ifdef WINDOWSNT extern int make_ctrl_char (int) ATTRIBUTE_CONST; +#endif extern void stuff_buffered_input (Lisp_Object); extern void clear_waiting_for_input (void); extern void swallow_events (bool); === modified file 'src/lisp.h' --- src/lisp.h 2013-10-17 03:08:59 +0000 +++ src/lisp.h 2013-10-17 06:42:21 +0000 @@ -3873,7 +3873,6 @@ extern void syms_of_fileio (void); extern Lisp_Object make_temp_name (Lisp_Object, bool); extern Lisp_Object Qdelete_file; -extern bool check_existing (const char *); /* Defined in search.c. */ extern void shrink_regexp_cache (void); === modified file 'src/process.c' --- src/process.c 2013-10-16 15:44:02 +0000 +++ src/process.c 2013-10-17 06:42:21 +0000 @@ -1958,6 +1958,9 @@ /* Convert an internal struct sockaddr to a lisp object (vector or string). The address family of sa is not included in the result. */ +#ifndef WINDOWSNT +static +#endif Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *sa, int len) { @@ -3504,43 +3507,10 @@ } -DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, - doc: /* Return an alist of all network interfaces and their network address. -Each element is a cons, the car of which is a string containing the -interface name, and the cdr is the network address in internal -format; see the description of ADDRESS in `make-network-process'. - -If the information is not available, return nil. */) - (void) -{ -#if (defined (HAVE_NET_IF_H) && defined (SIOCGIFCONF)) || defined (WINDOWSNT) - return network_interface_list (); -#else - return Qnil; -#endif -} - -DEFUN ("network-interface-info", Fnetwork_interface_info, Snetwork_interface_info, 1, 1, 0, - doc: /* Return information about network interface named IFNAME. -The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), -where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, -NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and -FLAGS is the current flags of the interface. - -Data that is unavailable is returned as nil. */) - (Lisp_Object ifname) -{ -#if (defined (HAVE_NET_IF_H) && (defined (SIOCGIFADDR) || defined (SIOCGIFHWADDR) || defined (SIOCGIFFLAGS))) || defined (WINDOWSNT) - return network_interface_info (ifname); -#else - return Qnil; -#endif -} - -#if defined (HAVE_NET_IF_H) +#ifdef HAVE_NET_IF_H #ifdef SIOCGIFCONF -Lisp_Object +static Lisp_Object network_interface_list (void) { struct ifconf ifconf; @@ -3683,7 +3653,7 @@ { 0, 0 } }; -Lisp_Object +static Lisp_Object network_interface_info (Lisp_Object ifname) { struct ifreq rq; @@ -3829,6 +3799,45 @@ #endif /* !SIOCGIFADDR && !SIOCGIFHWADDR && !SIOCGIFFLAGS */ #endif /* defined (HAVE_NET_IF_H) */ +DEFUN ("network-interface-list", Fnetwork_interface_list, + Snetwork_interface_list, 0, 0, 0, + doc: /* Return an alist of all network interfaces and their network address. +Each element is a cons, the car of which is a string containing the +interface name, and the cdr is the network address in internal +format; see the description of ADDRESS in `make-network-process'. + +If the information is not available, return nil. */) + (void) +{ +#if (defined HAVE_NET_IF_H && defined SIOCGIFCONF) || defined WINDOWSNT + return network_interface_list (); +#else + return Qnil; +#endif +} + +DEFUN ("network-interface-info", Fnetwork_interface_info, + Snetwork_interface_info, 1, 1, 0, + doc: /* Return information about network interface named IFNAME. +The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), +where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, +NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and +FLAGS is the current flags of the interface. + +Data that is unavailable is returned as nil. */) + (Lisp_Object ifname) +{ +#if ((defined HAVE_NET_IF_H \ + && (defined SIOCGIFADDR || defined SIOCGIFHWADDR \ + || defined SIOCGIFFLAGS)) \ + || defined WINDOWSNT) + return network_interface_info (ifname); +#else + return Qnil; +#endif +} + + /* Turn off input and output for process PROC. */ static void === modified file 'src/process.h' --- src/process.h 2013-10-16 17:36:04 +0000 +++ src/process.h 2013-10-17 06:42:21 +0000 @@ -227,7 +227,9 @@ extern void record_deleted_pid (pid_t, Lisp_Object); struct sockaddr; +#ifdef WINDOWSNT extern Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *, int); +#endif extern void hold_keyboard_input (void); extern void unhold_keyboard_input (void); extern bool kbd_on_hold_p (void); @@ -242,8 +244,9 @@ extern void catch_child_signal (void); #endif +#ifdef WINDOWSNT extern Lisp_Object network_interface_list (void); extern Lisp_Object network_interface_info (Lisp_Object); - +#endif INLINE_HEADER_END === modified file 'src/term.c' --- src/term.c 2013-10-14 15:37:12 +0000 +++ src/term.c 2013-10-17 06:42:21 +0000 @@ -500,8 +500,12 @@ Set CODING->produced to the byte-length of the resulting byte sequence, and return a pointer to that byte sequence. */ +#ifndef WINDOWSNT +static +#endif unsigned char * -encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding) +encode_terminal_code (struct glyph *src, int src_len, + struct coding_system *coding) { struct glyph *src_end = src + src_len; unsigned char *buf; === modified file 'src/termhooks.h' --- src/termhooks.h 2013-10-15 18:38:26 +0000 +++ src/termhooks.h 2013-10-17 06:42:21 +0000 @@ -630,8 +630,10 @@ /* The initial terminal device, created by initial_term_init. */ extern struct terminal *initial_terminal; +#ifdef WINDOWSNT extern unsigned char *encode_terminal_code (struct glyph *, int, struct coding_system *); +#endif #ifdef HAVE_GPM extern void close_gpm (int gpm_fd); === modified file 'src/w32.c' --- src/w32.c 2013-10-16 15:44:02 +0000 +++ src/w32.c 2013-10-17 06:42:21 +0000 @@ -2088,7 +2088,7 @@ /* For backwards compatibility, check if a .emacs file exists in C:/ If not, then we can try to default to the appdata directory under the user's profile, which is more likely to be writable. */ - if (!check_existing ("C:/.emacs")) + if (faccessat (AT_FDCWD, "C:/.emacs", F_OK, AT_EACCESS) != 0) { HRESULT profile_result; /* Dynamically load ShGetFolderPath, as it won't exist on versions @@ -2226,7 +2226,8 @@ strcpy (&fname[pend - pstart + 1], "cmdproxy.exe"); ExpandEnvironmentStrings ((LPSTR) fname, bufc, sizeof (bufc)); - if (check_existing (bufc)) + if (faccessat (AT_FDCWD, bufc, F_OK, AT_EACCESS) + == 0) { lpval = bufc; dwType = REG_SZ; === modified file 'src/xdisp.c' --- src/xdisp.c 2013-10-11 15:42:06 +0000 +++ src/xdisp.c 2013-10-17 06:42:21 +0000 @@ -26410,9 +26410,11 @@ } -/* EXPORT: - Erase the image of a cursor of window W from the screen. */ +/* Erase the image of a cursor of window W from the screen. */ +#ifndef WINDOWSNT +static +#endif void erase_phys_cursor (struct window *w) { === modified file 'src/xfaces.c' --- src/xfaces.c 2013-10-14 10:55:24 +0000 +++ src/xfaces.c 2013-10-17 06:42:21 +0000 @@ -1197,6 +1197,9 @@ record that fact in flags of the face so that we don't try to free these colors. */ +#ifndef MSDOS +static +#endif unsigned long load_color (struct frame *f, struct face *face, Lisp_Object name, enum lface_attribute_index target_index)