commit 224443922ce169ab0e21ad8495d32b269972c028 (HEAD, refs/remotes/origin/master) Author: Mark Oteiza Date: Tue Oct 18 18:05:51 2016 -0400 Add an option for eshell-input-filter * etc/NEWS: Document changes. * lisp/eshell/em-hist.el (eshell-input-filter): Set value to function symbol. Change type to a radio for choosing functions. Refer to both new functions. (eshell-input-filter-default): New function. Same body as the previous value of eshell-input-filter. (eshell-input-filter-initial-space): New function. diff --git a/etc/NEWS b/etc/NEWS index c5245bc..4f88de9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -308,6 +308,13 @@ viewing HTML files and the like. breakpoint (e.g. with "f" and "o") by customizing the new option 'edebug-sit-on-break'. +** Eshell + +*** 'eshell-input-filter's value is now a named function +'eshell-input-filter-default', and has a new custom option +'eshell-input-filter-initial-space' to ignore adding commands prefixed +with blank space to eshell history. + ** eww +++ diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 198b1d0..067c5ea 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -119,15 +119,14 @@ If set to t, history will always be saved, silently." (const :tag "Always save" t)) :group 'eshell-hist) -(defcustom eshell-input-filter - (function - (lambda (str) - (not (string-match "\\`\\s-*\\'" str)))) +(defcustom eshell-input-filter 'eshell-input-filter-default "Predicate for filtering additions to input history. Takes one argument, the input. If non-nil, the input may be saved on the input history list. Default is to save anything that isn't all whitespace." - :type 'function + :type '(radio (function-item eshell-input-filter-default) + (function-item eshell-input-filter-initial-space) + (function :tag "Other function")) :group 'eshell-hist) (put 'eshell-input-filter 'risky-local-variable t) @@ -206,6 +205,16 @@ element, regardless of any text on the command line. In that case, ;;; Functions: +(defun eshell-input-filter-default (input) + "Do not add blank input to input history. +Returns non-nil if INPUT is blank." + (not (string-match "\\`\\s-*\\'" input))) + +(defun eshell-input-filter-initial-space (input) + "Do not add input beginning with empty space to history. +Returns nil if INPUT is prepended by blank space, otherwise non-nil." + (not (string-match-p "\\`\\s-+" input))) + (defun eshell-hist-initialize () "Initialize the history management code for one Eshell buffer." (add-hook 'eshell-expand-input-functions commit 2ce01c494dd013a47f3b98860538cba4a1ef6a2c Author: Philipp Stephani Date: Tue Oct 18 21:16:55 2016 +0200 ; Fix embarassing typo diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 78646e4..ea31ee8 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -766,7 +766,7 @@ We run the first FUNCTION whose STRING matches the input events." (make-composed-keymap map (keymap-parent basemap)))) (define-minor-mode xterm-inhibit-bracketed-paste-mode - "Toggle whether XTerm bracketed paste should be allowed in this bugger. + "Toggle whether XTerm bracketed paste should be allowed in this buffer. With a prefix argument ARG, forbid bracketed paste if ARG is positive, and allow it otherwise. If called from Lisp, forbid bracketed paste if ARG is omitted or nil, and toggle the state of commit 704fd2a7ae5087f4108cc7a821f856fcdac99eb4 Author: Paul Eggert Date: Tue Oct 18 09:36:03 2016 -0700 delete-directory no longer errors when racing Problem reported by Glenn Morris for package-test.el (Bug#24714). * doc/lispref/files.texi (Create/Delete Dirs), etc/NEWS: Document this. * lisp/files.el (files--force): New function. (delete-directory): Use it to avoid error in this case. diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 9af5ce9..62e0199 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -2855,6 +2855,9 @@ This command deletes the directory named @var{dirname}. The function must use @code{delete-directory} for them. If @var{recursive} is @code{nil}, and the directory contains any files, @code{delete-directory} signals an error. +If recursive is non-@code{nil}, there is no error merely because the +directory or its files are deleted by some other process before +@code{delete-directory} gets to them. @code{delete-directory} only follows symbolic links at the level of parent directories. diff --git a/etc/NEWS b/etc/NEWS index 1fd2a00..c5245bc 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -619,6 +619,11 @@ collection). ** The new functions 'make-nearby-temp-file' and 'temporary-file-directory' can be used for creation of temporary files of remote or mounted directories. ++++ +** The function 'delete-directory' no longer signals an error when +operating recursively and when some other process deletes the directory +or its files before 'delete-directory' gets to them. + ** Changes in Frame- and Window- Handling +++ diff --git a/lisp/files.el b/lisp/files.el index f481b99..12c6c14 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5336,14 +5336,26 @@ raised." "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*" "Regexp matching any file name except \".\" and \"..\".") +(defun files--force (no-such fn &rest args) + "Use NO-SUCH to affect behavior of function FN applied to list ARGS. +This acts like (apply FN ARGS) except it returns NO-SUCH if it is +non-nil and if FN fails due to a missing file or directory." + (condition-case err + (apply fn args) + (file-error + (or (pcase err (`(,_ ,_ "No such file or directory" . ,_) no-such)) + (signal (car err) (cdr err)))))) + (defun delete-directory (directory &optional recursive trash) "Delete the directory named DIRECTORY. Does not follow symlinks. -If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well. +If RECURSIVE is non-nil, delete files in DIRECTORY as well, with +no error if something else is simultaneously deleting them. TRASH non-nil means to trash the directory instead, provided `delete-by-moving-to-trash' is non-nil. -When called interactively, TRASH is t if no prefix argument is -given. With a prefix argument, TRASH is nil." +When called interactively, TRASH is nil if and only if a prefix +argument is given, and a further prompt asks the user for +RECURSIVE if DIRECTORY is nonempty." (interactive (let* ((trashing (and delete-by-moving-to-trash (null current-prefix-arg))) @@ -5381,18 +5393,22 @@ given. With a prefix argument, TRASH is nil." (move-file-to-trash directory))) ;; Otherwise, call ourselves recursively if needed. (t - (if (and recursive (not (file-symlink-p directory))) - (mapc (lambda (file) - ;; This test is equivalent to - ;; (and (file-directory-p fn) (not (file-symlink-p fn))) - ;; but more efficient - (if (eq t (car (file-attributes file))) - (delete-directory file recursive nil) - (delete-file file nil))) - ;; We do not want to delete "." and "..". - (directory-files - directory 'full directory-files-no-dot-files-regexp))) - (delete-directory-internal directory))))) + (when (or (not recursive) (file-symlink-p directory) + (let* ((files + (files--force t #'directory-files directory 'full + directory-files-no-dot-files-regexp)) + (directory-exists (listp files))) + (when directory-exists + (mapc (lambda (file) + ;; This test is equivalent to but more efficient + ;; than (and (file-directory-p fn) + ;; (not (file-symlink-p fn))). + (if (eq t (car (file-attributes file))) + (delete-directory file recursive) + (files--force t #'delete-file file))) + files)) + directory-exists)) + (files--force recursive #'delete-directory-internal directory)))))) (defun file-equal-p (file1 file2) "Return non-nil if files FILE1 and FILE2 name the same file.