Now on revision 111622. ------------------------------------------------------------ revno: 111622 committer: Michael Albinus branch nick: trunk timestamp: Tue 2013-01-29 20:51:07 +0000 message: Amend to fontify /regexp/s in actions correctly. cc-awk.el (c-awk-harmless-char-re, c-awk-harmless-string*-re): (c-awk-harmless-string*-here-re): braces, parens and semicolons are no longer included. (c-awk-harmless-line-char-re, c-awk-harmless-line-string*-re): What used to be these variables without "-line" in the name. (c-awk-neutral-re): { is no longer neutral. Escaped newlines now are. (c-awk-non-arith-op-bra-re): Now also matches {. (c-awk-pre-exp-alphanum-kwd-re): New regexp to match "print", "return", and "case". (c-awk-kwd-regexp-sign-re): New, to match "print", etc., followed by /. (c-awk-syntax-tablify-/): Check special cases "print /re/", etc. (c-awk-set-syntax-table-properties): Extend FSM to handle {,},(,),;. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-01-29 16:03:40 +0000 +++ lisp/ChangeLog 2013-01-29 20:51:07 +0000 @@ -1,3 +1,22 @@ +2013-01-29 Alan Mackenzie + + Amend to fontify /regexp/s in actions correctly. + * cc-awk.el (c-awk-harmless-char-re, c-awk-harmless-string*-re): + (c-awk-harmless-string*-here-re): braces, parens and semicolons + are no longer included. + (c-awk-harmless-line-char-re, c-awk-harmless-line-string*-re): + What used to be these variables without "-line" in the name. + (c-awk-neutral-re): { is no longer neutral. Escaped newlines now + are. + (c-awk-non-arith-op-bra-re): Now also matches {. + (c-awk-pre-exp-alphanum-kwd-re): New regexp to match "print", + "return", and "case". + (c-awk-kwd-regexp-sign-re): New, to match "print", etc., followed + by /. + (c-awk-syntax-tablify-/): Check special cases "print /re/", etc. + (c-awk-set-syntax-table-properties): Extend FSM to handle + {,},(,),;. + 2013-01-29 Michael Albinus * autorevert.el (auto-revert-use-notify): Use === modified file 'lisp/progmodes/cc-awk.el' --- lisp/progmodes/cc-awk.el 2013-01-01 09:11:05 +0000 +++ lisp/progmodes/cc-awk.el 2013-01-29 20:51:07 +0000 @@ -127,22 +127,29 @@ ;; escaped EOL. ;; REGEXPS FOR "HARMLESS" STRINGS/LINES. -(defconst c-awk-harmless-char-re "[^_#/\"\\\\\n\r]") -;; Matches any character but a _, #, /, ", \, or newline. N.B. _" starts a -;; localization string in gawk 3.1 (defconst c-awk-harmless-_ "_\\([^\"]\\|\\'\\)") ;; Matches an underline NOT followed by ". +(defconst c-awk-harmless-char-re "[^_#/\"{}();\\\\\n\r]") +;; Matches any character not significant in the state machine applying +;; syntax-table properties to "s and /s. (defconst c-awk-harmless-string*-re (concat "\\(" c-awk-harmless-char-re "\\|" c-awk-esc-pair-re "\\|" c-awk-harmless-_ "\\)*")) +;; Matches a (possibly empty) sequence of characters insignificant in the +;; state machine applying syntax-table properties to "s and /s. +(defconst c-awk-harmless-string*-here-re + (concat "\\=" c-awk-harmless-string*-re)) +;; Matches the (possibly empty) sequence of "insignificant" chars at point. + +(defconst c-awk-harmless-line-char-re "[^_#/\"\\\\\n\r]") +;; Matches any character but a _, #, /, ", \, or newline. N.B. _" starts a +;; localisation string in gawk 3.1 +(defconst c-awk-harmless-line-string*-re + (concat "\\(" c-awk-harmless-line-char-re "\\|" c-awk-esc-pair-re "\\|" c-awk-harmless-_ "\\)*")) ;; Matches a (possibly empty) sequence of chars without unescaped /, ", \, ;; #, or newlines. -(defconst c-awk-harmless-string*-here-re - (concat "\\=" c-awk-harmless-string*-re)) -;; Matches the (possibly empty) sequence of chars without unescaped /, ", \, -;; at point. (defconst c-awk-harmless-line-re - (concat c-awk-harmless-string*-re - "\\(" c-awk-comment-without-nl "\\)?" c-awk-nl-or-eob)) + (concat c-awk-harmless-line-string*-re + "\\(" c-awk-comment-without-nl "\\)?" c-awk-nl-or-eob)) ;; Matches (the tail of) an AWK \"logical\" line not containing an unescaped ;; " or /. "logical" means "possibly containing escaped newlines". A comment ;; is matched as part of the line even if it contains a " or a /. The End of @@ -211,11 +218,11 @@ ;; division sign. (defconst c-awk-neutral-re ; "\\([{}@` \t]\\|\\+\\+\\|--\\|\\\\.\\)+") ; changed, 2003/6/7 - "\\([{}@` \t]\\|\\+\\+\\|--\\|\\\\.\\)") + "\\([}@` \t]\\|\\+\\+\\|--\\|\\\\\\(.\\|[\n\r]\\)\\)") ;; A "neutral" char(pair). Doesn't change the "state" of a subsequent /. -;; This is space/tab, braces, an auto-increment/decrement operator or an +;; This is space/tab, close brace, an auto-increment/decrement operator or an ;; escaped character. Or one of the (invalid) characters @ or `. But NOT an -;; end of line (even if escaped). +;; end of line (unless escaped). (defconst c-awk-neutrals*-re (concat "\\(" c-awk-neutral-re "\\)*")) ;; A (possibly empty) string of neutral characters (or character pairs). @@ -231,8 +238,8 @@ ;; will only work when there won't be a preceding " or / before the sought / ;; to foul things up. (defconst c-awk-non-arith-op-bra-re - "[[\(&=:!><,?;'~|]") -;; Matches an opening BRAcket, round or square, or any operator character + "[[\({&=:!><,?;'~|]") +;; Matches an opening BRAcket (of any sort), or any operator character ;; apart from +,-,/,*,%. For the purpose at hand (detecting a / which is a ;; regexp bracket) these arith ops are unnecessary and a pain, because of "++" ;; and "--". @@ -242,6 +249,16 @@ ;; bracket, in a context where an immediate / would be a division sign. This ;; will only work when there won't be a preceding " or / before the sought / ;; to foul things up. +(defconst c-awk-pre-exp-alphanum-kwd-re + (concat "\\(^\\|\\=\\|[^_\n\r]\\)\\<" + (regexp-opt '("print" "return" "case") t) + "\\>\\([^_\n\r]\\|$\\)")) +;; Matches all AWK keywords which can precede expressions (including +;; /regexp/). +(defconst c-awk-kwd-regexp-sign-re + (concat c-awk-pre-exp-alphanum-kwd-re c-awk-escaped-nls*-with-space* "/")) +;; Matches a piece of AWK buffer ending in /, where is a keyword +;; which can precede an expression. ;; REGEXPS USED FOR FINDING THE POSITION OF A "virtual semicolon" (defconst c-awk-_-harmless-nonws-char-re "[^#/\"\\\\\n\r \t]") @@ -721,9 +738,10 @@ (goto-char anchor) ;; Analyze the line to find out what the / is. (if (if anchor-state-/div - (not (search-forward-regexp c-awk-regexp-sign-re (1+ /point) t)) - (search-forward-regexp c-awk-div-sign-re (1+ /point) t)) - ;; A division sign. + (not (search-forward-regexp c-awk-regexp-sign-re (1+ /point) t)) + (and (not (search-forward-regexp c-awk-kwd-regexp-sign-re (1+ /point) t)) + (search-forward-regexp c-awk-div-sign-re (1+ /point) t))) + ;; A division sign. (progn (goto-char (1+ /point)) nil) ;; A regexp opener ;; Jump over the regexp innards, setting the match data. @@ -776,12 +794,20 @@ (< (point) lim)) (setq anchor (point)) (search-forward-regexp c-awk-harmless-string*-here-re nil t) - ;; We are now looking at either a " or a /. - ;; Do our thing on the string, regexp or division sign. + ;; We are now looking at either a " or a / or a brace/paren/semicolon. + ;; Do our thing on the string, regexp or divsion sign or update our state. (setq anchor-state-/div - (if (looking-at "_?\"") - (c-awk-syntax-tablify-string) - (c-awk-syntax-tablify-/ anchor anchor-state-/div)))) + (cond + ((looking-at "_?\"") + (c-awk-syntax-tablify-string)) + ((eq (char-after) ?/) + (c-awk-syntax-tablify-/ anchor anchor-state-/div)) + ((memq (char-after) '(?{ ?} ?\( ?\;)) + (forward-char) + nil) + (t ; ?\) + (forward-char) + t)))) nil)) ;; ACM, 2002/07/21: Thoughts: We need an AWK Mode after-change function to set ------------------------------------------------------------ revno: 111620 committer: Michael Albinus + * autorevert.el (auto-revert-use-notify): Use + `custom-initialize-default' for initialization. (Bug#13583) + * net/ange-ftp.el (ange-ftp-skip-msgs): Add another message. * net/tramp-sh.el (tramp-sh-handle-start-file-process): Catch === modified file 'lisp/autorevert.el' --- lisp/autorevert.el 2013-01-27 10:43:33 +0000 +++ lisp/autorevert.el 2013-01-29 16:03:40 +0000 @@ -289,6 +289,7 @@ (with-current-buffer buf (when (symbol-value 'auto-revert-notify-watch-descriptor) (auto-revert-notify-rm-watch))))))) + :initialize 'custom-initialize-default :version "24.4") (defcustom auto-revert-notify-exclude-dir-regexp === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2013-01-29 14:52:20 +0000 +++ lisp/net/tramp-sh.el 2013-01-29 16:03:40 +0000 @@ -988,7 +988,8 @@ (set-file-selinux-context . tramp-sh-handle-set-file-selinux-context) (file-acl . tramp-sh-handle-file-acl) (set-file-acl . tramp-sh-handle-set-file-acl) - (vc-registered . tramp-sh-handle-vc-registered)) + (vc-registered . tramp-sh-handle-vc-registered) + (inotify-add-watch . tramp-sh-handle-inotify-add-watch)) "Alist of handler functions. Operations not mentioned here will be handled by the normal Emacs functions.") @@ -3487,6 +3488,64 @@ ;; Default file name handlers, we don't care. (t (tramp-run-real-handler operation args))))))) +(defun tramp-sh-handle-inotify-add-watch (file-name aspect callback) + "Like `inotify-add-watch' for Tramp files." + (setq file-name (expand-file-name file-name)) + (unless (consp aspect) (setq aspect (cons aspect nil))) + (with-parsed-tramp-file-name file-name nil + (let* ((default-directory (file-name-directory file-name)) + (command (tramp-get-remote-inotifywait v)) + (aspect (mapconcat + (lambda (x) + (replace-regexp-in-string "-" "_" (symbol-name x))) + aspect ",")) + (p (and command + (start-file-process + "inotifywait" nil command "-mq" "-e" aspect localname)))) + (when (processp p) + (tramp-compat-set-process-query-on-exit-flag p nil) + (set-process-filter p 'tramp-sh-inotify-process-filter) + (tramp-set-connection-property p "inotify-callback" callback) + ;; Return the file-name vector as watch-descriptor. + (tramp-set-connection-property p "inotify-watch-descriptor" v))))) + +(defun tramp-sh-inotify-process-filter (proc string) + "Read output from \"inotifywait\" and add corresponding inotify events." + (tramp-message + (tramp-get-connection-property proc "vector" nil) 6 + (format "%s\n%s" proc string)) + (dolist (line (split-string string "[\n\r]+" 'omit-nulls)) + ;; Check, whether there is a problem. + (unless + (string-match + "^[^[:blank:]]+[[:blank:]]+\\([^[:blank:]]+\\)+\\([[:blank:]]+\\([^[:blank:]]+\\)\\)?[[:blank:]]*$" line) + (tramp-error proc 'filewatch-error "%s" line)) + + (let* ((object + (list + (tramp-get-connection-property + proc "inotify-watch-descriptor" nil) + ;; Aspect symbols. We filter out MOVE and CLOSE, which + ;; are convenience macros. See INOTIFY(7). + (mapcar + (lambda (x) + (intern-soft (replace-regexp-in-string "_" "-" (downcase x)))) + (delete "MOVE" (delete "CLOSE" + (split-string (match-string 1 line) "," 'omit-nulls)))) + ;; We cannot gather any cookie value. So we return 0 as + ;; "don't know". + 0 (match-string 3 line))) + (callback + (tramp-get-connection-property proc "inotify-callback" nil)) + (event `(file-inotify ,object ,callback))) + + ;; Usually, we would add an Emacs event now. Unfortunately, + ;; `unread-command-events' does not accept several events at + ;; once. Therefore, we apply the callback directly. + ;(setq unread-command-events (cons event unread-command-events))))) + (let ((last-input-event event)) + (funcall callback object))))) + ;;; Internal Functions: (defun tramp-maybe-send-script (vec script name) @@ -5046,6 +5105,11 @@ (tramp-message vec 5 "Finding a suitable `trash' command") (tramp-find-executable vec "trash" (tramp-get-remote-path vec)))) +(defun tramp-get-remote-inotifywait (vec) + (with-tramp-connection-property vec "inotifywait" + (tramp-message vec 5 "Finding a suitable `inotifywait' command") + (tramp-find-executable vec "inotifywait" (tramp-get-remote-path vec) t t))) + (defun tramp-get-remote-id (vec) (with-tramp-connection-property vec "id" (tramp-message vec 5 "Finding POSIX `id' command") ------------------------------------------------------------ revno: 111619 committer: Michael Albinus === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2013-01-29 08:12:11 +0000 +++ lisp/net/tramp-sh.el 2013-01-29 14:52:20 +0000 @@ -2826,20 +2826,20 @@ (unwind-protect ;; We catch this event. Otherwise, `start-process' could ;; be called on the local host. - (catch 'suppress - (save-excursion - (save-restriction - ;; Activate narrowing in order to save BUFFER - ;; contents. Clear also the modification time; - ;; otherwise we might be interrupted by - ;; `verify-visited-file-modtime'. - (let ((buffer-undo-list t) - (buffer-read-only nil) - (mark (point))) - (clear-visited-file-modtime) - (narrow-to-region (point-max) (point-max)) - ;; We call `tramp-maybe-open-connection', in order - ;; to cleanup the prompt afterwards. + (save-excursion + (save-restriction + ;; Activate narrowing in order to save BUFFER + ;; contents. Clear also the modification time; + ;; otherwise we might be interrupted by + ;; `verify-visited-file-modtime'. + (let ((buffer-undo-list t) + (buffer-read-only nil) + (mark (point))) + (clear-visited-file-modtime) + (narrow-to-region (point-max) (point-max)) + ;; We call `tramp-maybe-open-connection', in order + ;; to cleanup the prompt afterwards. + (catch 'suppress (tramp-maybe-open-connection v) (widen) (delete-region mark (point)) @@ -2864,7 +2864,7 @@ ;; Save exit. (if (string-match tramp-temp-buffer-name (buffer-name)) - (progn + (ignore-errors (set-process-buffer (tramp-get-connection-process v) nil) (kill-buffer (current-buffer))) (set-buffer-modified-p bmp)) @@ -4209,6 +4209,9 @@ (tramp-message vec 2 "Couldn't find an inline transfer compress command"))))) +(defvar tramp-gw-tunnel-method) +(defvar tramp-gw-socks-method) + (defun tramp-compute-multi-hops (vec) "Expands VEC according to `tramp-default-proxies-alist'. Gateway hops are already opened." @@ -4269,10 +4272,11 @@ (setq choices tramp-default-proxies-alist))))) ;; Handle gateways. - (when (string-match - (format - "^\\(%s\\|%s\\)$" tramp-gw-tunnel-method tramp-gw-socks-method) - (tramp-file-name-method (car target-alist))) + (when (and tramp-gw-tunnel-method tramp-gw-socks-method + (string-match + (format + "^\\(%s\\|%s\\)$" tramp-gw-tunnel-method tramp-gw-socks-method) + (tramp-file-name-method (car target-alist)))) (let ((gw (pop target-alist)) (hop (pop target-alist))) ;; Is the method prepared for gateways? ------------------------------------------------------------ revno: 111618 committer: Michael Albinus + + * net/ange-ftp.el (ange-ftp-skip-msgs): Add another message. + + * net/tramp-sh.el (tramp-sh-handle-start-file-process): Catch + `suppress'. Otherwise, `tramp-run-real-handler' might be called + in `tramp-file-name-handler'. + 2013-01-28 Stefan Monnier * hi-lock.el (hi-lock-unface-buffer): Don't assume `face' is a symbol === modified file 'lisp/net/ange-ftp.el' --- lisp/net/ange-ftp.el 2013-01-01 09:11:05 +0000 +++ lisp/net/ange-ftp.el 2013-01-29 08:12:11 +0000 @@ -720,6 +720,7 @@ "^Data connection \\|" "^local:\\|^Trying\\|^125 \\|^550-\\|^221 .*oodbye\\|" "^500 .*AUTH\\|^KERBEROS\\|" + "^500 This security scheme is not implemented\\|" "^504 Unknown security mechanism\\|" "^530 Please login with USER and PASS\\|" ; non kerberized vsFTPd "^534 Kerberos Authentication not enabled\\|" === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2013-01-24 09:50:02 +0000 +++ lisp/net/tramp-sh.el 2013-01-29 08:12:11 +0000 @@ -2824,40 +2824,43 @@ (with-current-buffer (tramp-get-connection-buffer v) (unwind-protect - (save-excursion - (save-restriction - ;; Activate narrowing in order to save BUFFER - ;; contents. Clear also the modification time; - ;; otherwise we might be interrupted by - ;; `verify-visited-file-modtime'. - (let ((buffer-undo-list t) - (buffer-read-only nil) - (mark (point))) - (clear-visited-file-modtime) - (narrow-to-region (point-max) (point-max)) - ;; We call `tramp-maybe-open-connection', in order - ;; to cleanup the prompt afterwards. - (tramp-maybe-open-connection v) - (widen) - (delete-region mark (point)) - (narrow-to-region (point-max) (point-max)) - ;; Now do it. - (if command - ;; Send the command. - (tramp-send-command v command nil t) ; nooutput - ;; Check, whether a pty is associated. - (unless (tramp-compat-process-get - (tramp-get-connection-process v) 'remote-tty) - (tramp-error - v 'file-error - "pty association is not supported for `%s'" name)))) - (let ((p (tramp-get-connection-process v))) - ;; Set query flag for this process. We ignore errors, - ;; because the process could have finished already. - (ignore-errors - (tramp-compat-set-process-query-on-exit-flag p t)) - ;; Return process. - p))) + ;; We catch this event. Otherwise, `start-process' could + ;; be called on the local host. + (catch 'suppress + (save-excursion + (save-restriction + ;; Activate narrowing in order to save BUFFER + ;; contents. Clear also the modification time; + ;; otherwise we might be interrupted by + ;; `verify-visited-file-modtime'. + (let ((buffer-undo-list t) + (buffer-read-only nil) + (mark (point))) + (clear-visited-file-modtime) + (narrow-to-region (point-max) (point-max)) + ;; We call `tramp-maybe-open-connection', in order + ;; to cleanup the prompt afterwards. + (tramp-maybe-open-connection v) + (widen) + (delete-region mark (point)) + (narrow-to-region (point-max) (point-max)) + ;; Now do it. + (if command + ;; Send the command. + (tramp-send-command v command nil t) ; nooutput + ;; Check, whether a pty is associated. + (unless (tramp-compat-process-get + (tramp-get-connection-process v) 'remote-tty) + (tramp-error + v 'file-error + "pty association is not supported for `%s'" name)))) + (let ((p (tramp-get-connection-process v))) + ;; Set query flag for this process. We ignore errors, + ;; because the process could have finished already. + (ignore-errors + (tramp-compat-set-process-query-on-exit-flag p t)) + ;; Return process. + p)))) ;; Save exit. (if (string-match tramp-temp-buffer-name (buffer-name)) ------------------------------------------------------------ revno: 111617 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13297 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-01-28 15:00:35 -0500 message: * lisp/hi-lock.el (hi-lock-unface-buffer): Don't assume `face' is a symbol. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-01-28 02:07:42 +0000 +++ lisp/ChangeLog 2013-01-28 20:00:35 +0000 @@ -1,11 +1,16 @@ +2013-01-28 Stefan Monnier + + * hi-lock.el (hi-lock-unface-buffer): Don't assume `face' is a symbol + (bug#13297). + 2013-01-27 Dmitry Gutov * progmodes/ruby-mode.el (ruby-font-lock-keywords): Remove some checks made superfluous by the \_< operator. * progmodes/ruby-mode.el (ruby-move-to-block): Work with (maybe temporarily) broken indentation. - * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight - nested constants, too. \_< broke that. + * progmodes/ruby-mode.el (ruby-font-lock-keywords): + Highlight nested constants, too. \_< broke that. 2013-01-27 Nobuyoshi Nakada @@ -117,8 +122,8 @@ 2013-01-22 Michael Albinus - * net/tramp-cmds.el (tramp-bug, tramp-append-tramp-buffers): Mark - descriptive parts with `display' property. + * net/tramp-cmds.el (tramp-bug, tramp-append-tramp-buffers): + Mark descriptive parts with `display' property. 2013-01-21 Agustín Martín Domingo @@ -147,13 +152,13 @@ * net/tramp-adb.el (top): Require `time-date'. (tramp-adb-ls-output-time-less-p): Use `tramp-time-less-p'. - (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): Use - `tramp-file-name-handler'. - (tramp-adb-maybe-open-connection): Use - `tramp-compat-set-process-query-on-exit-flag'. + (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): + Use `tramp-file-name-handler'. + (tramp-adb-maybe-open-connection): + Use `tramp-compat-set-process-query-on-exit-flag'. - * net/tramp-sh.el (tramp-sh-handle-file-acl): Use - `tramp-compat-funcall'. + * net/tramp-sh.el (tramp-sh-handle-file-acl): + Use `tramp-compat-funcall'. * net/tramp-smb.el (tramp-smb-handle-file-acl): Use `looking-at' and `tramp-compat-funcall'. @@ -193,8 +198,8 @@ 2013-01-19 Christian Wittern (tiny change) Chong Yidong - * image-mode.el (image-next-file, image-previous-file): New - commands (Bug#8453). + * image-mode.el (image-next-file, image-previous-file): + New commands (Bug#8453). (image-mode-map): Bind them to n and p. (image-mode--images-in-directory): New helper function. @@ -222,8 +227,8 @@ * autorevert.el (auto-revert-use-notify): In the :set function, do not modify `kill-buffer-hook'. - (auto-revert-notify-rm-watch): Remove - `auto-revert-notify-rm-watch' from `kill-buffer-hook'. + (auto-revert-notify-rm-watch): + Remove `auto-revert-notify-rm-watch' from `kill-buffer-hook'. (auto-revert-notify-add-watch): Do not call `auto-revert-notify-rm-watch', but add it to a buffer local `kill-buffer-hook'. === modified file 'lisp/hi-lock.el' --- lisp/hi-lock.el 2013-01-02 16:13:04 +0000 +++ lisp/hi-lock.el 2013-01-28 20:00:35 +0000 @@ -562,7 +562,8 @@ (when keyword (let ((face (hi-lock-keyword->face keyword))) ;; Make `face' the next one to use by default. - (add-to-list 'hi-lock--unused-faces (face-name face))) + (when (symbolp face) ;Don't add it if it's a list (bug#13297). + (add-to-list 'hi-lock--unused-faces (face-name face)))) (font-lock-remove-keywords nil (list keyword)) (setq hi-lock-interactive-patterns (delq keyword hi-lock-interactive-patterns))