2013-09-12 20:15:53 +00:00
|
|
|
;;; em-glob.el --- extended file name globbing -*- lexical-binding:t -*-
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2017-01-01 03:14:01 +00:00
|
|
|
;; Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2000-10-16 12:27:09 +00:00
|
|
|
;; Author: John Wiegley <johnw@gnu.org>
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 03:36:21 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-06-23 05:24:10 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:36:21 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; 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
|
2008-05-06 03:36:21 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; The globbing code used by Eshell closely follows the syntax used by
|
|
|
|
;; zsh. Basically, here is a summary of examples:
|
|
|
|
;;
|
|
|
|
;; echo a* ; anything starting with 'a'
|
|
|
|
;; echo a#b ; zero or more 'a's, then 'b'
|
|
|
|
;; echo a##b ; one or more 'a's, then 'b'
|
|
|
|
;; echo a? ; a followed by any character
|
|
|
|
;; echo a*~ab ; 'a', then anything, but not 'ab'
|
|
|
|
;; echo c*~*~ ; all files beginning with 'c', except backups (*~)
|
|
|
|
;;
|
|
|
|
;; Recursive globbing is also supported:
|
|
|
|
;;
|
|
|
|
;; echo **/*.c ; all '.c' files at or under current directory
|
|
|
|
;; echo ***/*.c ; same as above, but traverse symbolic links
|
|
|
|
;;
|
|
|
|
;; Using argument predication, the recursive globbing syntax is
|
|
|
|
;; sufficient to replace the use of 'find <expr> | xargs <cmd>' in
|
|
|
|
;; most cases. For example, to change the readership of all files
|
|
|
|
;; belonging to 'johnw' in the '/tmp' directory or lower, use:
|
|
|
|
;;
|
|
|
|
;; chmod go-r /tmp/**/*(u'johnw')
|
|
|
|
;;
|
|
|
|
;; The glob above matches all of the files beneath '/tmp' that are
|
|
|
|
;; owned by the user 'johnw'. See [Value modifiers and predicates],
|
|
|
|
;; for more information about argument predication.
|
|
|
|
|
2007-12-05 07:03:18 +00:00
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'esh-util)
|
Silence many eshell compilation warnings
* lisp/eshell/em-tramp.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/em-xtra.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/esh-ext.el: Adjust requires.
(eshell-parse-command, eshell-close-handles): Autoload.
* lisp/eshell/esh-io.el: Adjust requires.
(eshell-output-filter): Autoload.
* lisp/eshell/esh-util.el: No need to load tramp when compiling.
(tramp-file-name-structure, ange-ftp-ls, ange-ftp-file-modtime): Declare.
(eshell-parse-ange-ls): Require ange-ftp and tramp.
* lisp/eshell/em-alias.el, lisp/eshell/em-banner.el, lisp/eshell/em-basic.el:
* lisp/eshell/em-cmpl.el, lisp/eshell/em-glob.el, lisp/eshell/em-pred.el:
* lisp/eshell/em-prompt.el, lisp/eshell/em-rebind.el, lisp/eshell/em-smart.el:
* lisp/eshell/em-term.el, lisp/eshell/esh-arg.el, lisp/eshell/esh-mode.el:
* lisp/eshell/esh-opt.el, lisp/eshell/esh-proc.el:
* lisp/eshell/esh-var.el: Adjust requires.
* lisp/eshell/eshell.el: Do not require esh-util twice.
(eshell-add-input-to-history): Declare.
(eshell-command): Check history module is active before using it.
2013-05-23 04:57:27 +00:00
|
|
|
(eval-when-compile (require 'eshell))
|
2007-12-05 07:03:18 +00:00
|
|
|
|
2008-05-21 03:51:08 +00:00
|
|
|
;;;###autoload
|
Replace eshell-defgroup with plain defgroup
Borrowing a trick from vc-sccs.el, wrap the defgroup in a progn
so that the whole thing ends up in the generated autoload file,
esh-groups.el.
* em-alias.el, em-banner.el, em-basic.el, em-cmpl.el, em-dirs.el:
* em-glob.el, em-hist.el, em-ls.el, em-pred.el, em-prompt.el:
* em-rebind.el, em-script.el, em-smart.el, em-term.el, em-unix.el:
* em-xtra.el: Replace eshell-defgroup with (progn (defgroup.
* eshell.el (eshell-defgroup): Remove alias.
2012-06-27 07:08:06 +00:00
|
|
|
(progn
|
|
|
|
(defgroup eshell-glob nil
|
2007-12-05 07:03:18 +00:00
|
|
|
"This module provides extended globbing syntax, similar what is used
|
|
|
|
by zsh for filename generation."
|
|
|
|
:tag "Extended filename globbing"
|
Replace eshell-defgroup with plain defgroup
Borrowing a trick from vc-sccs.el, wrap the defgroup in a progn
so that the whole thing ends up in the generated autoload file,
esh-groups.el.
* em-alias.el, em-banner.el, em-basic.el, em-cmpl.el, em-dirs.el:
* em-glob.el, em-hist.el, em-ls.el, em-pred.el, em-prompt.el:
* em-rebind.el, em-script.el, em-smart.el, em-term.el, em-unix.el:
* em-xtra.el: Replace eshell-defgroup with (progn (defgroup.
* eshell.el (eshell-defgroup): Remove alias.
2012-06-27 07:08:06 +00:00
|
|
|
:group 'eshell-module))
|
2007-12-05 07:03:18 +00:00
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; User Variables:
|
|
|
|
|
2011-03-05 04:11:05 +00:00
|
|
|
(defcustom eshell-glob-load-hook nil
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"A list of functions to run when `eshell-glob' is loaded."
|
2011-03-05 04:11:05 +00:00
|
|
|
:version "24.1" ; removed eshell-glob-initialize
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'hook
|
|
|
|
:group 'eshell-glob)
|
|
|
|
|
|
|
|
(defcustom eshell-glob-include-dot-files nil
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"If non-nil, glob patterns will match files beginning with a dot."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'boolean
|
|
|
|
:group 'eshell-glob)
|
|
|
|
|
|
|
|
(defcustom eshell-glob-include-dot-dot t
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"If non-nil, glob patterns that match dots will match . and .."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'boolean
|
|
|
|
:group 'eshell-glob)
|
|
|
|
|
2002-08-10 00:18:18 +00:00
|
|
|
(defcustom eshell-glob-case-insensitive (eshell-under-windows-p)
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"If non-nil, glob pattern matching will ignore case."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'boolean
|
|
|
|
:group 'eshell-glob)
|
|
|
|
|
2000-10-29 05:18:48 +00:00
|
|
|
(defcustom eshell-glob-show-progress nil
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"If non-nil, display progress messages during a recursive glob.
|
2000-10-29 05:18:48 +00:00
|
|
|
This option slows down recursive glob processing by quite a bit."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'boolean
|
|
|
|
:group 'eshell-glob)
|
|
|
|
|
|
|
|
(defcustom eshell-error-if-no-glob nil
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"If non-nil, it is an error for a glob pattern not to match.
|
2011-11-19 09:18:31 +00:00
|
|
|
This mimics the behavior of zsh if non-nil, but bash if nil."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'boolean
|
|
|
|
:group 'eshell-glob)
|
|
|
|
|
2006-08-10 15:30:56 +00:00
|
|
|
(defcustom eshell-glob-chars-list '(?\] ?\[ ?* ?? ?~ ?\( ?\) ?| ?# ?^)
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"List of additional characters used in extended globbing."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type '(repeat character)
|
|
|
|
:group 'eshell-glob)
|
|
|
|
|
|
|
|
(defcustom eshell-glob-translate-alist
|
|
|
|
'((?\] . "]")
|
|
|
|
(?\[ . "[")
|
2006-08-10 15:30:56 +00:00
|
|
|
(?^ . "^")
|
2000-06-23 05:24:10 +00:00
|
|
|
(?? . ".")
|
|
|
|
(?* . ".*")
|
|
|
|
(?~ . "~")
|
|
|
|
(?\( . "\\(")
|
|
|
|
(?\) . "\\)")
|
|
|
|
(?\| . "\\|")
|
|
|
|
(?# . (lambda (str pos)
|
|
|
|
(if (and (< (1+ pos) (length str))
|
|
|
|
(memq (aref str (1+ pos)) '(?* ?# ?+ ??)))
|
|
|
|
(cons (if (eq (aref str (1+ pos)) ??)
|
|
|
|
"?"
|
|
|
|
(if (eq (aref str (1+ pos)) ?*)
|
|
|
|
"*" "+")) (+ pos 2))
|
|
|
|
(cons "*" (1+ pos))))))
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"An alist for translation of extended globbing characters."
|
2013-05-09 01:40:20 +00:00
|
|
|
:type '(alist :key-type character
|
|
|
|
:value-type (choice string function))
|
2000-06-23 05:24:10 +00:00
|
|
|
:group 'eshell-glob)
|
|
|
|
|
|
|
|
;;; Functions:
|
|
|
|
|
|
|
|
(defun eshell-glob-initialize ()
|
|
|
|
"Initialize the extended globbing code."
|
|
|
|
;; it's important that `eshell-glob-chars-list' come first
|
2002-11-07 23:00:32 +00:00
|
|
|
(when (boundp 'eshell-special-chars-outside-quoting)
|
|
|
|
(set (make-local-variable 'eshell-special-chars-outside-quoting)
|
|
|
|
(append eshell-glob-chars-list eshell-special-chars-outside-quoting)))
|
2000-06-23 05:24:10 +00:00
|
|
|
(add-hook 'eshell-parse-argument-hook 'eshell-parse-glob-chars t t)
|
|
|
|
(add-hook 'eshell-pre-rewrite-command-hook
|
|
|
|
'eshell-no-command-globbing nil t))
|
|
|
|
|
|
|
|
(defun eshell-no-command-globbing (terms)
|
|
|
|
"Don't glob the command argument. Reflect this by modifying TERMS."
|
|
|
|
(ignore
|
|
|
|
(when (and (listp (car terms))
|
|
|
|
(eq (caar terms) 'eshell-extended-glob))
|
|
|
|
(setcar terms (cadr (car terms))))))
|
|
|
|
|
|
|
|
(defun eshell-add-glob-modifier ()
|
|
|
|
"Add `eshell-extended-glob' to the argument modifier list."
|
|
|
|
(when (memq 'expand-file-name eshell-current-modifiers)
|
|
|
|
(setq eshell-current-modifiers
|
|
|
|
(delq 'expand-file-name eshell-current-modifiers))
|
|
|
|
;; if this is a glob pattern than needs to be expanded, then it
|
|
|
|
;; will need to expand each member of the resulting glob list
|
|
|
|
(add-to-list 'eshell-current-modifiers
|
2011-05-23 17:57:17 +00:00
|
|
|
(lambda (list)
|
|
|
|
(if (listp list)
|
|
|
|
(mapcar 'expand-file-name list)
|
|
|
|
(expand-file-name list)))))
|
2000-06-23 05:24:10 +00:00
|
|
|
(add-to-list 'eshell-current-modifiers 'eshell-extended-glob))
|
|
|
|
|
|
|
|
(defun eshell-parse-glob-chars ()
|
|
|
|
"Parse a globbing delimiter.
|
|
|
|
The character is not advanced for ordinary globbing characters, so
|
|
|
|
that other function may have a chance to override the globbing
|
|
|
|
interpretation."
|
|
|
|
(when (memq (char-after) eshell-glob-chars-list)
|
|
|
|
(if (not (memq (char-after) '(?\( ?\[)))
|
|
|
|
(ignore (eshell-add-glob-modifier))
|
|
|
|
(let ((here (point)))
|
|
|
|
(forward-char)
|
|
|
|
(let* ((delim (char-before))
|
|
|
|
(end (eshell-find-delimiter
|
|
|
|
delim (if (eq delim ?\[) ?\] ?\)))))
|
|
|
|
(if (not end)
|
|
|
|
(throw 'eshell-incomplete delim)
|
|
|
|
(if (and (eshell-using-module 'eshell-pred)
|
|
|
|
(eshell-arg-delimiter (1+ end)))
|
|
|
|
(ignore (goto-char here))
|
|
|
|
(eshell-add-glob-modifier)
|
|
|
|
(prog1
|
|
|
|
(buffer-substring-no-properties (1- (point)) (1+ end))
|
|
|
|
(goto-char (1+ end))))))))))
|
|
|
|
|
2004-05-08 12:39:01 +00:00
|
|
|
(defvar eshell-glob-chars-regexp nil)
|
Cleanup Eshell to rely less on dynamic scoping.
* lisp/eshell/esh-opt.el (eshell-eval-using-options): Don't bind usage-msg,
last-value, and ext-command here. Bind `args' closer to `body'.
(temp-args, last-value, usage-msg, ext-command, args): Don't defvar.
(eshell--args): Declare new dynamic var.
(eshell-do-opt): Add argument `args'. Bind our own usage-msg,
last-value, and ext-command. Pass `args' to `body'.
(eshell-process-args): Bind eshell--args.
(eshell-set-option): Use eshell--args.
* lisp/eshell/eshell.el (eshell): Use derived-mode-p.
* lisp/eshell/esh-var.el (eshell-parse-variable): Use backquote.
(eshell-parse-variable-ref): Remove unused vars `end' and `err'.
(eshell-glob-function): Declare.
* lisp/eshell/esh-util.el: Require cl-lib.
(eshell-read-hosts-file): Avoid add-to-list.
* lisp/eshell/esh-cmd.el (eshell-parse-lisp-argument): Remove unused var
`err'.
* lisp/eshell/em-unix.el (compilation-scroll-output, locate-history-list):
Declare.
(eshell/diff): Remove unused var `err'.
* lisp/eshell/em-rebind.el (eshell-delete-backward-char): Remove unused arg
`killflag'.
* lisp/eshell/em-pred.el (eshell-parse-modifiers): Remove unused var `err'.
* lisp/eshell/em-ls.el (eshell-ls-highlight-alist): Move defvars before
first use.
* lisp/eshell/em-glob.el (eshell-glob-matches, message-shown):
Move declaration before first use.
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias): Use backquotes.
* autorevert.el (auto-revert-notify-handler): Use `cl-dolist' since we
rely on cl-return.
2013-09-12 05:20:07 +00:00
|
|
|
(defvar eshell-glob-matches)
|
|
|
|
(defvar message-shown)
|
2004-05-08 12:39:01 +00:00
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
(defun eshell-glob-regexp (pattern)
|
|
|
|
"Convert glob-pattern PATTERN to a regular expression.
|
|
|
|
The basic syntax is:
|
|
|
|
|
|
|
|
glob regexp meaning
|
|
|
|
---- ------ -------
|
|
|
|
? . matches any single character
|
|
|
|
* .* matches any group of characters (or none)
|
|
|
|
# * matches zero or more occurrences of preceding
|
|
|
|
## + matches one or more occurrences of preceding
|
2015-09-17 19:28:45 +00:00
|
|
|
(x) \\(x\\) makes `x' a regular expression group
|
|
|
|
| \\| boolean OR within an expression group
|
2000-06-23 05:24:10 +00:00
|
|
|
[a-b] [a-b] matches a character or range
|
|
|
|
[^a] [^a] excludes a character or range
|
|
|
|
|
|
|
|
If any characters in PATTERN have the text property `eshell-escaped'
|
|
|
|
set to true, then these characters will match themselves in the
|
|
|
|
resulting regular expression."
|
|
|
|
(let ((matched-in-pattern 0) ; How much of PATTERN handled
|
|
|
|
regexp)
|
2004-05-08 12:39:01 +00:00
|
|
|
(while (string-match
|
|
|
|
(or eshell-glob-chars-regexp
|
|
|
|
(set (make-local-variable 'eshell-glob-chars-regexp)
|
|
|
|
(format "[%s]+" (apply 'string eshell-glob-chars-list))))
|
|
|
|
pattern matched-in-pattern)
|
2000-06-23 05:24:10 +00:00
|
|
|
(let* ((op-begin (match-beginning 0))
|
|
|
|
(op-char (aref pattern op-begin)))
|
|
|
|
(setq regexp
|
|
|
|
(concat regexp
|
|
|
|
(regexp-quote
|
|
|
|
(substring pattern matched-in-pattern op-begin))))
|
|
|
|
(if (get-text-property op-begin 'escaped pattern)
|
|
|
|
(setq regexp (concat regexp
|
|
|
|
(regexp-quote (char-to-string op-char)))
|
|
|
|
matched-in-pattern (1+ op-begin))
|
|
|
|
(let ((xlat (assq op-char eshell-glob-translate-alist)))
|
|
|
|
(if (not xlat)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(error "Unrecognized globbing character `%c'" op-char)
|
2000-06-23 05:24:10 +00:00
|
|
|
(if (stringp (cdr xlat))
|
|
|
|
(setq regexp (concat regexp (cdr xlat))
|
|
|
|
matched-in-pattern (1+ op-begin))
|
|
|
|
(let ((result (funcall (cdr xlat) pattern op-begin)))
|
|
|
|
(setq regexp (concat regexp (car result))
|
|
|
|
matched-in-pattern (cdr result)))))))))
|
|
|
|
(concat "\\`"
|
|
|
|
regexp
|
|
|
|
(regexp-quote (substring pattern matched-in-pattern))
|
|
|
|
"\\'")))
|
|
|
|
|
2013-09-18 05:11:38 +00:00
|
|
|
(defvar ange-cache) ; XEmacs? See esh-util
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
(defun eshell-extended-glob (glob)
|
|
|
|
"Return a list of files generated from GLOB, perhaps looking for DIRS-ONLY.
|
2002-11-07 23:00:32 +00:00
|
|
|
This function almost fully supports zsh style filename generation
|
|
|
|
syntax. Things that are not supported are:
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
^foo for matching everything but foo
|
|
|
|
(foo~bar) tilde within a parenthesis group
|
|
|
|
foo<1-10> numeric ranges
|
|
|
|
foo~x(a|b) (a|b) will be interpreted as a predicate/modifier list
|
|
|
|
|
2002-11-07 23:00:32 +00:00
|
|
|
Mainly they are not supported because file matching is done with Emacs
|
|
|
|
regular expressions, and these cannot support the above constructs.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2002-11-07 23:00:32 +00:00
|
|
|
If this routine fails, it returns nil. Otherwise, it returns a list
|
|
|
|
the form:
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(INCLUDE-REGEXP EXCLUDE-REGEXP (PRED-FUNC-LIST) (MOD-FUNC-LIST))"
|
|
|
|
(let ((paths (eshell-split-path glob))
|
2010-11-10 03:53:03 +00:00
|
|
|
eshell-glob-matches message-shown ange-cache)
|
2000-06-23 05:24:10 +00:00
|
|
|
(unwind-protect
|
|
|
|
(if (and (cdr paths)
|
|
|
|
(file-name-absolute-p (car paths)))
|
|
|
|
(eshell-glob-entries (file-name-as-directory (car paths))
|
|
|
|
(cdr paths))
|
2005-11-01 09:31:26 +00:00
|
|
|
(eshell-glob-entries (file-name-as-directory ".") paths))
|
2000-06-23 05:24:10 +00:00
|
|
|
(if message-shown
|
|
|
|
(message nil)))
|
2010-11-10 03:53:03 +00:00
|
|
|
(or (and eshell-glob-matches (sort eshell-glob-matches #'string<))
|
2000-06-23 05:24:10 +00:00
|
|
|
(if eshell-error-if-no-glob
|
|
|
|
(error "No matches found: %s" glob)
|
|
|
|
glob))))
|
|
|
|
|
2010-11-10 03:53:03 +00:00
|
|
|
;; FIXME does this really need to abuse eshell-glob-matches, message-shown?
|
2000-06-23 05:24:10 +00:00
|
|
|
(defun eshell-glob-entries (path globs &optional recurse-p)
|
|
|
|
"Glob the entries in PATHS, possibly recursing if RECURSE-P is non-nil."
|
|
|
|
(let* ((entries (ignore-errors
|
|
|
|
(file-name-all-completions "" path)))
|
|
|
|
(case-fold-search eshell-glob-case-insensitive)
|
|
|
|
(glob (car globs))
|
|
|
|
(len (length glob))
|
|
|
|
dirs rdirs
|
|
|
|
incl excl
|
|
|
|
name isdir pathname)
|
|
|
|
(while (cond
|
|
|
|
((and (= len 3) (equal glob "**/"))
|
|
|
|
(setq recurse-p 2
|
|
|
|
globs (cdr globs)
|
|
|
|
glob (car globs)
|
|
|
|
len (length glob)))
|
|
|
|
((and (= len 4) (equal glob "***/"))
|
|
|
|
(setq recurse-p 3
|
|
|
|
globs (cdr globs)
|
|
|
|
glob (car globs)
|
|
|
|
len (length glob)))))
|
|
|
|
(if (and recurse-p (not glob))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(error "`**' cannot end a globbing pattern"))
|
2000-06-23 05:24:10 +00:00
|
|
|
(let ((index 1))
|
|
|
|
(setq incl glob)
|
|
|
|
(while (and (eq incl glob)
|
|
|
|
(setq index (string-match "~" glob index)))
|
|
|
|
(if (or (get-text-property index 'escaped glob)
|
|
|
|
(or (= (1+ index) len)))
|
|
|
|
(setq index (1+ index))
|
|
|
|
(setq incl (substring glob 0 index)
|
|
|
|
excl (substring glob (1+ index))))))
|
|
|
|
;; can't use `directory-file-name' because it strips away text
|
|
|
|
;; properties in the string
|
|
|
|
(let ((len (1- (length incl))))
|
2005-05-31 00:14:26 +00:00
|
|
|
(if (eq (aref incl len) ?/)
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq incl (substring incl 0 len)))
|
|
|
|
(when excl
|
|
|
|
(setq len (1- (length excl)))
|
2005-05-31 00:14:26 +00:00
|
|
|
(if (eq (aref excl len) ?/)
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq excl (substring excl 0 len)))))
|
|
|
|
(setq incl (eshell-glob-regexp incl)
|
|
|
|
excl (and excl (eshell-glob-regexp excl)))
|
|
|
|
(if (or eshell-glob-include-dot-files
|
|
|
|
(eq (aref glob 0) ?.))
|
|
|
|
(unless (or eshell-glob-include-dot-dot
|
|
|
|
(cdr globs))
|
|
|
|
(setq excl (if excl
|
|
|
|
(concat "\\(\\`\\.\\.?\\'\\|" excl "\\)")
|
|
|
|
"\\`\\.\\.?\\'")))
|
|
|
|
(setq excl (if excl
|
|
|
|
(concat "\\(\\`\\.\\|" excl "\\)")
|
|
|
|
"\\`\\.")))
|
|
|
|
(when (and recurse-p eshell-glob-show-progress)
|
|
|
|
(message "Building file list...%d so far: %s"
|
2010-11-10 03:53:03 +00:00
|
|
|
(length eshell-glob-matches) path)
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq message-shown t))
|
|
|
|
(if (equal path "./") (setq path ""))
|
|
|
|
(while entries
|
|
|
|
(setq name (car entries)
|
|
|
|
len (length name)
|
2005-05-31 00:14:26 +00:00
|
|
|
isdir (eq (aref name (1- len)) ?/))
|
2000-06-23 05:24:10 +00:00
|
|
|
(if (let ((fname (directory-file-name name)))
|
|
|
|
(and (not (and excl (string-match excl fname)))
|
|
|
|
(string-match incl fname)))
|
|
|
|
(if (cdr globs)
|
|
|
|
(if isdir
|
|
|
|
(setq dirs (cons (concat path name) dirs)))
|
2010-11-10 03:53:03 +00:00
|
|
|
(setq eshell-glob-matches
|
|
|
|
(cons (concat path name) eshell-glob-matches))))
|
2000-06-23 05:24:10 +00:00
|
|
|
(if (and recurse-p isdir
|
|
|
|
(or (> len 3)
|
|
|
|
(not (or (and (= len 2) (equal name "./"))
|
|
|
|
(and (= len 3) (equal name "../")))))
|
|
|
|
(setq pathname (concat path name))
|
|
|
|
(not (and (= recurse-p 2)
|
|
|
|
(file-symlink-p
|
|
|
|
(directory-file-name pathname)))))
|
|
|
|
(setq rdirs (cons pathname rdirs)))
|
|
|
|
(setq entries (cdr entries)))
|
|
|
|
(setq dirs (nreverse dirs)
|
|
|
|
rdirs (nreverse rdirs))
|
|
|
|
(while dirs
|
|
|
|
(eshell-glob-entries (car dirs) (cdr globs))
|
|
|
|
(setq dirs (cdr dirs)))
|
|
|
|
(while rdirs
|
|
|
|
(eshell-glob-entries (car rdirs) globs recurse-p)
|
|
|
|
(setq rdirs (cdr rdirs)))))
|
|
|
|
|
2007-12-05 07:03:18 +00:00
|
|
|
(provide 'em-glob)
|
|
|
|
|
2008-05-21 03:51:08 +00:00
|
|
|
;; Local Variables:
|
|
|
|
;; generated-autoload-file: "esh-groups.el"
|
|
|
|
;; End:
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; em-glob.el ends here
|