commit bd074d9bab470da24dd79491d8c25b22c2a5bb3d (HEAD, refs/remotes/origin/master) Author: Michael Albinus Date: Mon Mar 27 10:13:11 2017 +0200 * lisp/net/tramp.el (tramp-file-name-handler): Autoload it. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 41406d82ce..0ca5a6d3ac 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1994,6 +1994,7 @@ ARGS are the arguments OPERATION has been called with." (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers))) ;; Main function. +;;;###autoload (defun tramp-file-name-handler (operation &rest args) "Invoke Tramp file name handler. Falls back to normal file name handler if no Tramp file name handler exists." commit 05bfebfc91bc053435287f560aeb956926d31583 Author: Philipp Stephani Date: Sun Dec 20 21:59:10 2015 +0100 Add check for expected backtrace in module calls. * test.el (mod-test-non-local-exit-signal-test): Compare actual backtrace to expected backtrace. diff --git a/modules/mod-test/test.el b/modules/mod-test/test.el index 181f13208e..caa807d300 100644 --- a/modules/mod-test/test.el +++ b/modules/mod-test/test.el @@ -64,7 +64,21 @@ ;; (ert-deftest mod-test-non-local-exit-signal-test () - (should-error (mod-test-signal))) + (should-error (mod-test-signal)) + (let (debugger-args backtrace) + (should-error + (let ((debugger (lambda (&rest args) + (setq debugger-args args + backtrace (with-output-to-string (backtrace))) + (cl-incf num-nonmacro-input-events))) + (debug-on-signal t)) + (mod-test-signal))) + (should (equal debugger-args '(error (error . 56)))) + (should (string-match-p + (rx bol " internal--module-call(" (+ nonl) ?\) ?\n + " apply(internal--module-call " (+ nonl) ?\) ?\n + " mod-test-signal()" eol) + backtrace)))) (ert-deftest mod-test-non-local-exit-throw-test () (should (equal commit a749b55d8ee530797ccff693ad302541257d0415 Author: Eli Zaretskii Date: Sun Mar 26 21:36:52 2017 +0300 Fix redisplay glitches due to recent change in redisplay_internal * src/xdisp.c (redisplay_internal): A better fix for bug#26097. See http://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00695.html for the problems caused by the original fix. diff --git a/src/xdisp.c b/src/xdisp.c index 32550523bc..af086d17eb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14073,7 +14073,6 @@ redisplay_internal (void) /* Only GC scrollbars when we redisplay the whole frame. */ = f->redisplay || !REDISPLAY_SOME_P (); bool f_redisplay_flag = f->redisplay; - bool f_garbaged_flag = FRAME_GARBAGED_P (f); /* Mark all the scroll bars to be removed; we'll redeem the ones we want when we redisplay their windows. */ if (gcscrollbars && FRAME_TERMINAL (f)->condemn_scroll_bars_hook) @@ -14134,30 +14133,16 @@ redisplay_internal (void) Therefore, we must redisplay this frame. */ if (!f_redisplay_flag && f->redisplay) goto retry_frame; - /* Likewise with the frame's garbaged flag: it can - get set inside redisplay_windows if some hook - winds up calling adjust_frame_glyphs, for example. */ - if (!f_garbaged_flag && FRAME_GARBAGED_P (f)) - { - f->garbaged = false; - fset_redisplay (f); - goto retry_frame; - } - /* In some case (e.g., window resize), we notice only during window updating that the window content changed unpredictably (e.g., a GTK - scrollbar moved) and that our previous estimation - of the frame content was garbage. We have to - start over. These cases should be rare, so going - all the way back to the top of redisplay should - be good enough. - - Why FRAME_WINDOW_P? See - https://lists.gnu.org/archive/html/emacs-devel/2016-10/msg00957.html - - */ - if (FRAME_GARBAGED_P (f) && FRAME_WINDOW_P (f)) + scrollbar moved, or some Lisp hook that winds up + calling adjust_frame_glyphs) and that our + previous estimation of the frame content was + garbage. We have to start over. These cases + should be rare, so going all the way back to the + top of redisplay should be good enough. */ + if (FRAME_GARBAGED_P (f)) goto retry; /* Prevent various kinds of signals during display commit 8884baf3c8919abd67071296ed4784739bf94c00 Author: Michael Albinus Date: Sun Mar 26 17:37:00 2017 +0200 Fix Bug#26258 * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Autoload. Call `tramp-register-foreign-file-name-handler'. (Bug#26258) * lisp/net/tramp.el (tramp-autoload-file-name-handler): Remove. (tramp-register-autoload-file-name-handlers) (tramp-register-file-name-handlers): Do not handle `tramp-autoload-file-name-handler' anymore. Mark `operations' the handlers are responsible for. (tramp-register-foreign-file-name-handler): New defun. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 4191c3ec93..240e017279 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -94,9 +94,6 @@ It is used for TCP/IP devices." tramp-adb-method '((tramp-adb-parse-device-names "")))) ;;;###tramp-autoload -(add-to-list 'tramp-foreign-file-name-handler-alist - (cons 'tramp-adb-file-name-p 'tramp-adb-file-name-handler)) - (defconst tramp-adb-file-name-handler-alist '((access-file . ignore) (add-name-to-file . tramp-adb-handle-copy-file) @@ -190,6 +187,10 @@ pass to the OPERATION." (tramp-run-real-handler operation args)))) ;;;###tramp-autoload +(tramp-register-foreign-file-name-handler + 'tramp-adb-file-name-p 'tramp-adb-file-name-handler) + +;;;###tramp-autoload (defun tramp-adb-parse-device-names (_ignore) "Return a list of (nil host) tuples allowed to access." (with-timeout (10) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 561f6c8f79..59d8771cf1 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -452,6 +452,7 @@ Every entry is a list (NAME ADDRESS).") ;; New handlers should be added here. +;;;###tramp-autoload (defconst tramp-gvfs-file-name-handler-alist '((access-file . ignore) (add-name-to-file . tramp-gvfs-handle-copy-file) @@ -548,12 +549,10 @@ pass to the OPERATION." (save-match-data (apply (cdr fn) args)) (tramp-run-real-handler operation args)))) -;; This might be moved to tramp.el. It shall be the first file name -;; handler. ;;;###tramp-autoload (when (featurep 'dbusbind) - (add-to-list 'tramp-foreign-file-name-handler-alist - (cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler))) + (tramp-register-foreign-file-name-handler + 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler)) ;; D-Bus helper function. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 486e002fac..e0f8d714e1 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -981,6 +981,7 @@ here-document, otherwise the command could exceed maximum length of command line.") ;; New handlers should be added here. +;;;###tramp-autoload (defconst tramp-sh-file-name-handler-alist '(;; `access-file' performed by default handler. (add-name-to-file . tramp-sh-handle-add-name-to-file) @@ -1054,11 +1055,6 @@ of command line.") "Alist of handler functions. Operations not mentioned here will be handled by the normal Emacs functions.") -;; This must be the last entry, because `identity' always matches. -;;;###tramp-autoload -(add-to-list 'tramp-foreign-file-name-handler-alist - '(identity . tramp-sh-file-name-handler) 'append) - ;;; File Name Handler Functions: (defun tramp-sh-handle-make-symbolic-link @@ -3536,6 +3532,11 @@ Fall back to normal file name handler if no Tramp handler exists." (tramp-run-real-handler operation args))))) (setq tramp-locked tl)))) +;; This must be the last entry, because `identity' always matches. +;;;###tramp-autoload +(tramp-register-foreign-file-name-handler + 'identity 'tramp-sh-file-name-handler 'append) + (defun tramp-vc-file-name-handler (operation &rest args) "Invoke special file name handler, which collects files to be handled." (save-match-data diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index eaa8ac655e..b91a726956 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -217,6 +217,7 @@ This list is used for smbcacls actions. See `tramp-actions-before-shell' for more info.") ;; New handlers should be added here. +;;;###tramp-autoload (defconst tramp-smb-file-name-handler-alist '(;; `access-file' performed by default handler. (add-name-to-file . tramp-smb-handle-add-name-to-file) @@ -340,9 +341,8 @@ pass to the OPERATION." ;;;###tramp-autoload (unless (memq system-type '(cygwin windows-nt)) - (add-to-list 'tramp-foreign-file-name-handler-alist - (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler))) - + (tramp-register-foreign-file-name-handler + 'tramp-smb-file-name-p 'tramp-smb-file-name-handler)) ;; File name primitives. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a7c36c09e0..41406d82ce 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2121,41 +2121,26 @@ Falls back to normal file name handler if no Tramp file name handler exists." (save-match-data (apply (cdr fn) args)) (tramp-run-real-handler operation args)))) -;; Mark `operations' the handler is responsible for. -;;;###autoload -(put 'tramp-completion-file-name-handler 'operations - (mapcar 'car tramp-completion-file-name-handler-alist)) - -;;;###autoload -(progn (defun tramp-autoload-file-name-handler (operation &rest args) - "Load Tramp file name handler, and perform OPERATION." - (if (and - ;; Do not load tramp.el just for "/". - (not (and (stringp (car args)) (string-equal (car args) "/"))) - ;; Avoid recursive loading of tramp.el. - (let ((default-directory temporary-file-directory)) - (and (null load-in-progress) (load "tramp" 'noerror 'nomessage)))) - (apply operation args) - ;; tramp.el not needed or not available for loading, fall back. - (tramp-run-real-handler operation args)))) - -;; `tramp-autoload-file-name-handler' must be registered before -;; evaluation of site-start and init files, because there might exist -;; remote files already, f.e. files kept via recentf-mode. We cannot -;; autoload `tramp-file-name-handler', because it would result in -;; recursive loading of tramp.el when `default-directory' is set to -;; remote. +;; `tramp-file-name-handler' must be registered before evaluation of +;; site-start and init files, because there might exist remote files +;; already, f.e. files kept via recentf-mode. ;;;###autoload (progn (defun tramp-register-autoload-file-name-handlers () "Add Tramp file name handlers to `file-name-handler-alist' during autoload." (add-to-list 'file-name-handler-alist - (cons tramp-file-name-regexp - 'tramp-autoload-file-name-handler)) - (put 'tramp-autoload-file-name-handler 'safe-magic t) + (cons tramp-file-name-regexp 'tramp-file-name-handler)) + (put 'tramp-file-name-handler 'safe-magic t) + ;; Mark `operations' the handler is responsible for. It's a short list ... + (put 'tramp-file-name-handler 'operations + '(file-name-all-completions file-name-completion file-remote-p)) + (add-to-list 'file-name-handler-alist (cons tramp-completion-file-name-regexp 'tramp-completion-file-name-handler)) - (put 'tramp-completion-file-name-handler 'safe-magic t))) + (put 'tramp-completion-file-name-handler 'safe-magic t) + ;; Mark `operations' the handler is responsible for. + (put 'tramp-completion-file-name-handler 'operations + (mapcar 'car tramp-completion-file-name-handler-alist)))) ;;;###autoload (tramp-register-autoload-file-name-handlers) @@ -2165,22 +2150,29 @@ Falls back to normal file name handler if no Tramp file name handler exists." ;; Remove autoloaded handlers from file name handler alist. Useful, ;; if `tramp-syntax' has been changed. (dolist (fnh '(tramp-file-name-handler - tramp-completion-file-name-handler - tramp-autoload-file-name-handler)) + tramp-completion-file-name-handler)) (let ((a1 (rassq fnh file-name-handler-alist))) (setq file-name-handler-alist (delq a1 file-name-handler-alist)))) + ;; The initial value of `tramp-file-name-regexp' is too simple ;; minded, but we cannot give it the real value in the autoload ;; pattern. See Bug#24889. (setq tramp-file-name-regexp (car tramp-file-name-structure)) - ;; Add the handlers. + ;; Add the handlers. We do not add anything to the `operations' + ;; property of `tramp-file-name-handler', this shall be done by the + ;; respective foreign handlers. (add-to-list 'file-name-handler-alist (cons tramp-file-name-regexp 'tramp-file-name-handler)) (put 'tramp-file-name-handler 'safe-magic t) + (add-to-list 'file-name-handler-alist (cons tramp-completion-file-name-regexp 'tramp-completion-file-name-handler)) (put 'tramp-completion-file-name-handler 'safe-magic t) + ;; Mark `operations' the handler is responsible for. + (put 'tramp-completion-file-name-handler 'operations + (mapcar 'car tramp-completion-file-name-handler-alist)) + ;; If jka-compr or epa-file are already loaded, move them to the ;; front of `file-name-handler-alist'. (dolist (fnh '(epa-file-handler jka-compr-handler)) @@ -2191,6 +2183,24 @@ Falls back to normal file name handler if no Tramp file name handler exists." (eval-after-load 'tramp (tramp-register-file-name-handlers)) +;;;###tramp-autoload +(progn (defun tramp-register-foreign-file-name-handler + (func handler &optional append) + "Register (FUNC . HANDLER) in `tramp-foreign-file-name-handler-alist'. +FUNC is the function, which determines whether HANDLER is to be called. +Add operations defined in `HANDLER-alist' to `tramp-file-name-handler'." + (add-to-list + 'tramp-foreign-file-name-handler-alist `(,func . ,handler) append) + ;; Mark `operations' the handler is responsible for. + (put 'tramp-file-name-handler + 'operations + (cl-delete-duplicates + (append + (get 'tramp-file-name-handler 'operations) + (mapcar + 'car + (symbol-value (intern (concat (symbol-name handler) "-alist"))))))))) + (defun tramp-exists-file-name-handler (operation &rest args) "Check, whether OPERATION runs a file name handler." ;; The file name handler is determined on base of either an commit 082e2cb3f40b717e4c00d31532927c9693b7cb9b Author: Andreas Politz Date: Sun Mar 26 11:41:12 2017 +0200 Minor fixes for inotify.c and filenotify.el * lisp/filenotify.el (file-notify--watch-absolute-filename): Add docstring. (file-notify-callback): Simplify. * src/inotify.c (Finotify_add_watch): Adapt docstring. diff --git a/lisp/filenotify.el b/lisp/filenotify.el index 55ce94a1ca..c3d7d7223a 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el @@ -52,6 +52,7 @@ could use another implementation.") callback) (defun file-notify--watch-absolute-filename (watch) + "Return the absolute filename observed by WATCH." (if (file-notify--watch-filename watch) (expand-file-name (file-notify--watch-filename watch) @@ -204,7 +205,7 @@ EVENT is the cadr of the event in `file-notify-handle-event' (car file-notify--pending-event))) ;; If the source is handled by another watch, we ;; must fire the rename event there as well. - (when (not (equal desc (caar file-notify--pending-event))) + (unless (equal desc (caar file-notify--pending-event)) (setq pending-event `((,(caar file-notify--pending-event) renamed ,file ,file1) @@ -214,9 +215,6 @@ EVENT is the cadr of the event in `file-notify-handle-event' ;; Apply pending callback. (when pending-event - (setcar - (car pending-event) - (caar pending-event)) (funcall (cadr pending-event) (car pending-event)) (setq pending-event nil)) diff --git a/src/inotify.c b/src/inotify.c index 470b60ba89..cb24e82762 100644 --- a/src/inotify.c +++ b/src/inotify.c @@ -382,9 +382,17 @@ If a directory is watched then NAME is the name of file that caused the event. COOKIE is an object that can be compared using `equal' to identify two matching renames (moved-from and moved-to). -See inotify(7) and inotify_add_watch(2) for further information. The inotify fd -is managed internally and there is no corresponding inotify_init. Use -`inotify-rm-watch' to remove a watch. */) +See inotify(7) and inotify_add_watch(2) for further information. The +inotify fd is managed internally and there is no corresponding +inotify_init. Use `inotify-rm-watch' to remove a watch. + +Also note, that the following inotify bit-masks can not be used, due +to the fact that descriptors are shared across different callers. + +IN_EXCL_UNLINK +IN_MASK_ADD +IN_ONESHOT +IN_ONLYDIR */) (Lisp_Object filename, Lisp_Object aspect, Lisp_Object callback) { Lisp_Object encoded_file_name;