2013-03-05 17:13:01 +00:00
|
|
|
|
;;; filesets.el --- handle group of files -*- coding: utf-8 -*-
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2013-01-01 09:11:05 +00:00
|
|
|
|
;; Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2008-10-23 22:26:04 +00:00
|
|
|
|
;; Author: Thomas Link <sanobast-emacs@yahoo.de>
|
2003-05-03 13:48:39 +00:00
|
|
|
|
;; Maintainer: FSF
|
2002-04-28 21:16:32 +00:00
|
|
|
|
;; Keywords: filesets convenience
|
|
|
|
|
|
2002-04-29 08:48:34 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2002-04-28 21:16:32 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2002-04-28 21:16:32 +00:00
|
|
|
|
;; 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.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(defvar filesets-version "1.8.4")
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(defvar filesets-homepage
|
|
|
|
|
"http://members.a1.net/t.link/CompEmacsFilesets.html")
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
2002-04-29 17:47:04 +00:00
|
|
|
|
;; Define filesets, which can be opened or saved with the power of one or
|
2002-04-29 08:48:34 +00:00
|
|
|
|
;; two mouse clicks only. A fileset is either a list of files, a file
|
|
|
|
|
;; pattern, a base directory and a search pattern (for files), or an
|
|
|
|
|
;; inclusion group (i.e. a base file including other files).
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2003-04-24 01:55:38 +00:00
|
|
|
|
;; Usage:
|
2012-09-17 05:41:04 +00:00
|
|
|
|
;; 1. Put (require 'filesets) and (filesets-init) in your init file.
|
2003-04-24 01:55:38 +00:00
|
|
|
|
;; 2. Type ;; M-x filesets-edit or choose "Edit Filesets" from the menu.
|
|
|
|
|
;; 3. Save your customizations.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2002-04-29 08:48:34 +00:00
|
|
|
|
;; Caveat: Fileset names have to be unique.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2002-04-29 08:48:34 +00:00
|
|
|
|
;; Filesets.el adds a nifty filesets menu to your menubar. If you change
|
|
|
|
|
;; your filesets on the fly, don't forget to select "Save Filesets" from
|
|
|
|
|
;; the menu.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2002-04-29 08:48:34 +00:00
|
|
|
|
;; Pressing on the first item in the submenu will open all files at once.
|
|
|
|
|
;; Define your own function, e.g. browse-url, for opening a fileset's
|
|
|
|
|
;; files. Or define external viewers for opening files with other
|
|
|
|
|
;; programs. See `filesets-external-viewers'.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2002-04-29 08:48:34 +00:00
|
|
|
|
;; BTW, if you close a fileset, files, which have been changed, will
|
2008-06-27 07:34:53 +00:00
|
|
|
|
;; be silently saved. Change this behavior by setting
|
2002-04-29 08:48:34 +00:00
|
|
|
|
;; `filesets-save-buffer-fn'.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
;;; Supported modes for inclusion groups (`filesets-ingroup-patterns'):
|
|
|
|
|
;; - Elisp
|
|
|
|
|
;; - Emacs-Wiki (simple names only)
|
|
|
|
|
;; - LaTeX
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Known bugs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; To do:
|
|
|
|
|
|
|
|
|
|
;;- better handling of different customization scenarios
|
|
|
|
|
|
2003-05-03 13:48:39 +00:00
|
|
|
|
;; Data gathering should be better separated from building the menu
|
|
|
|
|
;; so that one could (1) use filesets without installing the menu
|
|
|
|
|
;; and (2) create new "frontends" to speedbar and others.
|
|
|
|
|
|
|
|
|
|
;; The functionality to call external viewers should be isolated in
|
|
|
|
|
;; an extra package and possibly integrated with the MIME
|
|
|
|
|
;; handling.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
;;; Credits:
|
|
|
|
|
|
|
|
|
|
;; Helpful suggestions (but no significant code) were contributed by
|
|
|
|
|
|
|
|
|
|
;;- Christoph Conrad (at gmx de)
|
|
|
|
|
;;- Christian Ohler (at Informatik Uni-Oldenburg DE)
|
|
|
|
|
;;- Richard Stallman aka RMS (at gnu org)
|
|
|
|
|
;;- Per Abrahamsen aka abraham (at dina kvl dk)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(eval-when-compile (require 'cl-lib))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
;;; Some variables
|
|
|
|
|
|
|
|
|
|
(defvar filesets-menu-cache nil
|
|
|
|
|
"The whole filesets menu.")
|
|
|
|
|
(defvar filesets-cache-version nil
|
|
|
|
|
"Filesets' cached version number.")
|
|
|
|
|
(defvar filesets-cache-hostname nil
|
|
|
|
|
"Filesets' cached system name.")
|
|
|
|
|
|
|
|
|
|
(defvar filesets-ingroup-cache nil
|
|
|
|
|
"A plist containing files and their ingroup data.")
|
2002-04-30 01:59:00 +00:00
|
|
|
|
(defvar filesets-ingroup-files nil
|
|
|
|
|
"List of files already processed when searching for included files.")
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defvar filesets-has-changed-flag t
|
|
|
|
|
"Non-nil means some fileset definition has changed.")
|
|
|
|
|
(defvar filesets-submenus nil
|
|
|
|
|
"An association list with filesets menu data.")
|
|
|
|
|
(defvar filesets-updated-buffers nil
|
|
|
|
|
"A list of buffers with updated menu bars.")
|
|
|
|
|
(defvar filesets-menu-use-cached-flag nil
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Use cached data. See `filesets-menu-ensure-use-cached' for details.")
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(defvar filesets-update-cache-file-flag nil
|
|
|
|
|
"Non-nil means the cache needs updating.")
|
|
|
|
|
(defvar filesets-ignore-next-set-default nil
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"List of custom variables for which the next `set-default' will be ignored.")
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defvar filesets-output-buffer-flag nil
|
|
|
|
|
"Non-nil means the current buffer is an output buffer created by filesets.
|
|
|
|
|
Is buffer local variable.")
|
|
|
|
|
|
|
|
|
|
(defvar filesets-verbosity 1
|
2003-05-03 13:48:39 +00:00
|
|
|
|
"An integer defining the level of verbosity.
|
|
|
|
|
0 means no messages at all.")
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defvar filesets-menu-ensure-use-cached
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(and (featurep 'xemacs)
|
2005-05-30 06:51:33 +00:00
|
|
|
|
(if (fboundp 'emacs-version>=)
|
|
|
|
|
(not (emacs-version>= 21 5))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
"Make sure (X)Emacs uses filesets' cache.
|
|
|
|
|
|
|
|
|
|
Well, if you use XEmacs (prior to 21.5?) custom.el is loaded after
|
|
|
|
|
init.el. This means that settings saved in the cache file (see
|
|
|
|
|
`filesets-menu-cache-file') will be overwritten by custom.el. In order
|
|
|
|
|
to ensure the use of the cache file, set this variable to t -- which is
|
|
|
|
|
the default for XEmacs prior to 21.5. If you want to change this value
|
|
|
|
|
put \"(setq filesets-menu-ensure-use-cached VALUE)\" into your startup
|
|
|
|
|
file -- before loading filesets.el.
|
|
|
|
|
|
|
|
|
|
So, when should you think about setting this value to t? If filesets.el
|
|
|
|
|
is loaded before user customizations. Thus, if (require 'filesets)
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
precedes the `custom-set-variables' command or, for XEmacs, if init.el
|
|
|
|
|
is loaded before custom.el, set this variable to t.")
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; utils
|
|
|
|
|
(defun filesets-filter-list (lst cond-fn)
|
|
|
|
|
"Remove all elements not conforming to COND-FN from list LST.
|
|
|
|
|
COND-FN takes one argument: the current element."
|
2013-07-12 03:54:57 +00:00
|
|
|
|
; (cl-remove 'dummy lst :test (lambda (dummy elt)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
; (not (funcall cond-fn elt)))))
|
|
|
|
|
(let ((rv nil))
|
|
|
|
|
(dolist (elt lst rv)
|
|
|
|
|
(when (funcall cond-fn elt)
|
|
|
|
|
(setq rv (append rv (list elt)))))))
|
|
|
|
|
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(defun filesets-ormap (fsom-pred lst)
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Return the tail of LST for the head of which FSOM-PRED is non-nil."
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(let ((fsom-lst lst)
|
|
|
|
|
(fsom-rv nil))
|
|
|
|
|
(while (and (not (null fsom-lst))
|
|
|
|
|
(null fsom-rv))
|
|
|
|
|
(if (funcall fsom-pred (car fsom-lst))
|
|
|
|
|
(setq fsom-rv fsom-lst)
|
|
|
|
|
(setq fsom-lst (cdr fsom-lst))))
|
|
|
|
|
fsom-rv))
|
|
|
|
|
|
|
|
|
|
(defun filesets-some (fss-pred fss-lst)
|
2003-01-27 08:44:27 +00:00
|
|
|
|
"Return non-nil if FSS-PRED is non-nil for any element of FSS-LST.
|
2002-05-07 16:11:30 +00:00
|
|
|
|
Like `some', return the first value of FSS-PRED that is non-nil."
|
|
|
|
|
(catch 'exit
|
|
|
|
|
(dolist (fss-this fss-lst nil)
|
|
|
|
|
(let ((fss-rv (funcall fss-pred fss-this)))
|
|
|
|
|
(when fss-rv
|
|
|
|
|
(throw 'exit fss-rv))))))
|
2013-07-12 03:54:57 +00:00
|
|
|
|
;(fset 'filesets-some 'cl-some) ;; or use the cl function
|
2002-05-07 16:11:30 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-member (fsm-item fsm-lst &rest fsm-keys)
|
|
|
|
|
"Find the first occurrence of FSM-ITEM in FSM-LST.
|
2007-09-19 15:16:31 +00:00
|
|
|
|
It is supposed to work like cl's `member*'. At the moment only the :test
|
2002-05-07 16:11:30 +00:00
|
|
|
|
key is supported."
|
|
|
|
|
(let ((fsm-test (or (plist-get fsm-keys ':test)
|
|
|
|
|
(function equal))))
|
|
|
|
|
(filesets-ormap (lambda (fsm-this)
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(funcall fsm-test fsm-item fsm-this))
|
2002-05-07 16:11:30 +00:00
|
|
|
|
fsm-lst)))
|
2013-07-12 03:54:57 +00:00
|
|
|
|
;(fset 'filesets-member 'cl-member) ;; or use the cl function
|
2002-05-07 16:11:30 +00:00
|
|
|
|
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(defun filesets-sublist (lst beg &optional end)
|
|
|
|
|
"Get the sublist of LST from BEG to END - 1."
|
|
|
|
|
(let ((rv nil)
|
|
|
|
|
(i beg)
|
|
|
|
|
(top (or end
|
|
|
|
|
(length lst))))
|
|
|
|
|
(while (< i top)
|
|
|
|
|
(setq rv (append rv (list (nth i lst))))
|
|
|
|
|
(setq i (+ i 1)))
|
|
|
|
|
rv))
|
|
|
|
|
|
|
|
|
|
(defun filesets-select-command (cmd-list)
|
|
|
|
|
"Select one command from CMD-LIST -- a string with space separated names."
|
|
|
|
|
(let ((this (shell-command-to-string
|
|
|
|
|
(format "which --skip-alias %s 2> /dev/null | head -n 1"
|
|
|
|
|
cmd-list))))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(if (equal this "")
|
2002-04-28 21:16:32 +00:00
|
|
|
|
nil
|
|
|
|
|
(file-name-nondirectory (substring this 0 (- (length this) 1))))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-which-command (cmd)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Call \"which CMD\"."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(shell-command-to-string (format "which %s" cmd)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-which-command-p (cmd)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Call \"which CMD\" and return non-nil if the command was found."
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(when (string-match-p (format "\\(/[^/]+\\)?/%s" cmd)
|
|
|
|
|
(filesets-which-command cmd))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
cmd))
|
|
|
|
|
|
|
|
|
|
(defun filesets-message (level &rest args)
|
|
|
|
|
"Show a message only if LEVEL is greater or equal then `filesets-verbosity'."
|
|
|
|
|
(when (<= level (abs filesets-verbosity))
|
|
|
|
|
(apply 'message args)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; config file
|
|
|
|
|
(defun filesets-save-config ()
|
|
|
|
|
"Save filesets' customizations."
|
|
|
|
|
(interactive)
|
|
|
|
|
(customize-save-customized))
|
|
|
|
|
|
|
|
|
|
(defun filesets-reset-fileset (&optional fileset no-cache)
|
|
|
|
|
"Reset the cached values for one or all filesets."
|
|
|
|
|
(if fileset
|
|
|
|
|
(setq filesets-submenus (lax-plist-put filesets-submenus fileset nil))
|
|
|
|
|
(setq filesets-submenus nil))
|
|
|
|
|
(setq filesets-has-changed-flag t)
|
|
|
|
|
(setq filesets-update-cache-file-flag (or filesets-update-cache-file-flag
|
|
|
|
|
(not no-cache))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-set-config (fileset var val)
|
|
|
|
|
"Set-default wrapper function."
|
|
|
|
|
(filesets-reset-fileset fileset)
|
|
|
|
|
(set-default var val))
|
|
|
|
|
; (customize-set-variable var val))
|
|
|
|
|
; (filesets-build-menu))
|
|
|
|
|
|
2005-04-03 16:55:58 +00:00
|
|
|
|
;; It seems this is a workaround for the XEmacs issue described in the
|
2007-09-19 15:16:31 +00:00
|
|
|
|
;; doc-string of filesets-menu-ensure-use-cached. Under Emacs this is
|
2005-04-03 16:55:58 +00:00
|
|
|
|
;; essentially just `set-default'.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(defun filesets-set-default (sym val &optional init-flag)
|
2005-04-03 16:55:58 +00:00
|
|
|
|
"Set-default wrapper function used in conjunction with `defcustom'.
|
|
|
|
|
If SYM is in the list `filesets-ignore-next-set-default', delete
|
|
|
|
|
it from that list, and return nil. Otherwise, set the value of
|
|
|
|
|
SYM to VAL and return t. If INIT-FLAG is non-nil, set with
|
|
|
|
|
`custom-initialize-set', otherwise with `set-default'."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((ignore-flag (member sym filesets-ignore-next-set-default)))
|
|
|
|
|
(if ignore-flag
|
|
|
|
|
(setq filesets-ignore-next-set-default
|
|
|
|
|
(delete sym filesets-ignore-next-set-default))
|
|
|
|
|
(if init-flag
|
|
|
|
|
(custom-initialize-set sym val)
|
|
|
|
|
(set-default sym val)))
|
|
|
|
|
(not ignore-flag)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-set-default! (sym val)
|
2011-11-27 04:43:11 +00:00
|
|
|
|
"Call `filesets-set-default' and reset cached data (i.e. rebuild menu)."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(when (filesets-set-default sym val)
|
|
|
|
|
(filesets-reset-fileset)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-set-default+ (sym val)
|
2011-11-27 04:43:11 +00:00
|
|
|
|
"Call `filesets-set-default' and reset filesets' standard menu."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(when (filesets-set-default sym val)
|
|
|
|
|
(setq filesets-has-changed-flag t)))
|
|
|
|
|
; (filesets-reset-fileset nil t)))
|
|
|
|
|
|
2003-05-03 13:48:39 +00:00
|
|
|
|
(defvar filesets-data)
|
|
|
|
|
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(defun filesets-data-set-default (sym val)
|
|
|
|
|
"Set the default for `filesets-data'."
|
|
|
|
|
(if filesets-menu-use-cached-flag
|
|
|
|
|
(setq filesets-menu-use-cached-flag nil)
|
|
|
|
|
(when (default-boundp 'filesets-data)
|
|
|
|
|
(let ((modified-filesets
|
|
|
|
|
(filesets-filter-list val
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(let ((name (car x))
|
|
|
|
|
(data (cdr x)))
|
|
|
|
|
(let ((elt (assoc name filesets-data)))
|
|
|
|
|
(or (not elt)
|
|
|
|
|
(not (equal data (cdr elt))))))))))
|
|
|
|
|
(dolist (x modified-filesets)
|
|
|
|
|
(filesets-reset-fileset (car x))))))
|
|
|
|
|
(filesets-set-default sym val))
|
2003-05-03 13:48:39 +00:00
|
|
|
|
|
2002-04-28 21:16:32 +00:00
|
|
|
|
;;; configuration
|
|
|
|
|
(defgroup filesets nil
|
|
|
|
|
"The fileset swapper."
|
|
|
|
|
:prefix "filesets-"
|
2004-11-04 09:59:56 +00:00
|
|
|
|
:group 'convenience
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defcustom filesets-menu-name "Filesets"
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Filesets' menu name."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default)
|
2008-10-01 07:00:10 +00:00
|
|
|
|
:type 'string
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
2008-10-01 07:00:10 +00:00
|
|
|
|
(defcustom filesets-menu-path '("File") ; cf recentf-menu-path
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"The menu under which the filesets menu should be inserted.
|
2005-03-30 15:14:55 +00:00
|
|
|
|
See `add-submenu' for documentation."
|
|
|
|
|
:set (function filesets-set-default)
|
2008-10-01 07:00:10 +00:00
|
|
|
|
:type '(choice (const :tag "Top Level" nil)
|
|
|
|
|
(sexp :tag "Menu Path"))
|
|
|
|
|
:version "23.1" ; was nil
|
2005-03-30 15:14:55 +00:00
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
2008-10-01 07:00:10 +00:00
|
|
|
|
(defcustom filesets-menu-before "Open File..." ; cf recentf-menu-before
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"The name of a menu before which this menu should be added.
|
2005-03-30 15:14:55 +00:00
|
|
|
|
See `add-submenu' for documentation."
|
|
|
|
|
:set (function filesets-set-default)
|
2008-10-01 07:00:10 +00:00
|
|
|
|
:type '(choice (string :tag "Name")
|
|
|
|
|
(const :tag "Last" nil))
|
|
|
|
|
:version "23.1" ; was "File"
|
2005-03-30 15:14:55 +00:00
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-menu-in-menu nil
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Use that instead of `current-menubar' as the menu to change.
|
2005-03-30 15:14:55 +00:00
|
|
|
|
See `add-submenu' for documentation."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'sexp
|
|
|
|
|
:group 'filesets)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defcustom filesets-menu-shortcuts-flag t
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Non-nil means to prepend menus with hopefully unique shortcuts."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default!)
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-menu-shortcuts-marker "%_"
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"String for marking menu shortcuts."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default!)
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
;;(defcustom filesets-menu-cnvfp-flag nil
|
2010-09-24 02:59:16 +00:00
|
|
|
|
;; "Non-nil means show \"Convert :pattern to :files\" entry for :pattern menus."
|
2007-09-19 15:16:31 +00:00
|
|
|
|
;; :set (function filesets-set-default!)
|
|
|
|
|
;; :type 'boolean
|
|
|
|
|
;; :group 'filesets)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defcustom filesets-menu-cache-file
|
2008-10-24 09:39:27 +00:00
|
|
|
|
(locate-user-emacs-file "filesets-cache.el")
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"File to be used for saving the filesets menu between sessions.
|
2002-05-05 01:55:25 +00:00
|
|
|
|
Set this to \"\", to disable caching of menus.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
Don't forget to check out `filesets-menu-ensure-use-cached'."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'file
|
|
|
|
|
:group 'filesets)
|
2002-05-05 01:55:25 +00:00
|
|
|
|
(put 'filesets-menu-cache-file 'risky-local-variable t)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defcustom filesets-menu-cache-contents
|
|
|
|
|
'(filesets-be-docile-flag
|
|
|
|
|
filesets-submenus
|
2003-01-27 08:44:27 +00:00
|
|
|
|
filesets-menu-cache
|
2002-04-28 21:16:32 +00:00
|
|
|
|
filesets-ingroup-cache)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Stuff we want to save in `filesets-menu-cache-file'.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
Possible uses: don't save configuration data in the main startup files
|
|
|
|
|
but in filesets's own cache. In this case add `filesets-data' to this
|
|
|
|
|
list.
|
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
There is a second reason for putting `filesets-data' on this list. If
|
2002-04-28 21:16:32 +00:00
|
|
|
|
you frequently add and remove buffers on the fly to :files filesets, you
|
|
|
|
|
don't need to save your customizations if `filesets-data' is being
|
2007-09-19 15:16:31 +00:00
|
|
|
|
mirrored in the cache file. In this case the version in the cache file
|
2002-04-28 21:16:32 +00:00
|
|
|
|
is the current one, and the version in your startup file will be
|
|
|
|
|
silently updated later on.
|
|
|
|
|
|
|
|
|
|
If you want caching to work properly, at least `filesets-submenus',
|
|
|
|
|
`filesets-menu-cache', and `filesets-ingroup-cache' should be in this
|
|
|
|
|
list.
|
|
|
|
|
|
|
|
|
|
Don't forget to check out `filesets-menu-ensure-use-cached'."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type '(repeat
|
|
|
|
|
(choice :tag "Variable"
|
|
|
|
|
(const :tag "filesets-submenus"
|
|
|
|
|
:value filesets-submenus)
|
|
|
|
|
(const :tag "filesets-menu-cache"
|
|
|
|
|
:value filesets-menu-cache)
|
|
|
|
|
(const :tag "filesets-ingroup-cache"
|
|
|
|
|
:value filesets-ingroup-cache)
|
|
|
|
|
(const :tag "filesets-data"
|
|
|
|
|
:value filesets-data)
|
|
|
|
|
(const :tag "filesets-external-viewers"
|
|
|
|
|
:value filesets-external-viewers)
|
|
|
|
|
(const :tag "filesets-ingroup-patterns"
|
|
|
|
|
:value filesets-ingroup-patterns)
|
|
|
|
|
(const :tag "filesets-be-docile-flag"
|
|
|
|
|
:value filesets-be-docile-flag)
|
|
|
|
|
(sexp :tag "Other" :value nil)))
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
2012-10-23 15:06:07 +00:00
|
|
|
|
(define-obsolete-variable-alias 'filesets-cache-fill-content-hooks
|
|
|
|
|
'filesets-cache-fill-content-hook "24.3")
|
|
|
|
|
(defcustom filesets-cache-fill-content-hook nil
|
|
|
|
|
"Hook run when writing the contents of filesets' cache file.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
The hook is called with the cache file as current buffer and the cursor
|
|
|
|
|
at the last position. I.e. each hook has to make sure that the cursor is
|
|
|
|
|
at the last position.
|
|
|
|
|
|
|
|
|
|
Possible uses: If you don't want to save `filesets-data' in your normal
|
|
|
|
|
configuration file, you can add a something like this
|
|
|
|
|
|
|
|
|
|
\(lambda ()
|
|
|
|
|
\(insert (format \"(setq-default filesets-data '%S)\"
|
|
|
|
|
filesets-data))
|
|
|
|
|
\(newline 2))
|
|
|
|
|
|
|
|
|
|
to this hook.
|
|
|
|
|
|
|
|
|
|
Don't forget to check out `filesets-menu-ensure-use-cached'."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'hook
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-cache-hostname-flag nil
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Non-nil means cache the hostname.
|
2002-05-05 01:55:25 +00:00
|
|
|
|
If the current name differs from the cached one,
|
|
|
|
|
rebuild the menu and create a new cache file."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-cache-save-often-flag nil
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Non-nil means save buffer on every change of the filesets menu.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
If this variable is set to nil and if Emacs crashes, the cache and
|
2007-09-19 15:16:31 +00:00
|
|
|
|
filesets-data could get out of sync. Set this to t if this happens from
|
2002-04-28 21:16:32 +00:00
|
|
|
|
time to time or if the fileset cache causes troubles."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-max-submenu-length 25
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Maximum length of submenus.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
Set this value to 0 to turn menu splitting off. BTW, parts of submenus
|
|
|
|
|
will not be rewrapped if their length exceeds this value."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-max-entry-length 50
|
2011-12-15 07:24:10 +00:00
|
|
|
|
"Truncate names of split submenus to this length."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
2002-05-05 01:55:25 +00:00
|
|
|
|
(defcustom filesets-browse-dir-function 'dired
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"A function or command used for browsing directories.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
When using an external command, \"%s\" will be replaced with the
|
|
|
|
|
directory's name.
|
|
|
|
|
|
|
|
|
|
Note: You have to manually rebuild the menu if you change this value."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type '(choice :tag "Function:"
|
|
|
|
|
(const :tag "dired"
|
|
|
|
|
:value dired)
|
|
|
|
|
(list :tag "Command"
|
|
|
|
|
:value ("" "%s")
|
|
|
|
|
(string :tag "Name")
|
|
|
|
|
(string :tag "Arguments"))
|
|
|
|
|
(function :tag "Function"
|
|
|
|
|
:value nil))
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
2002-05-05 01:55:25 +00:00
|
|
|
|
(defcustom filesets-open-file-function 'filesets-find-or-display-file
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"The function used for opening files.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
`filesets-find-or-display-file' ... Filesets' default function for
|
|
|
|
|
visiting files. This function checks if an external viewer is defined
|
|
|
|
|
for a specific file type. Either this viewer, if defined, or
|
|
|
|
|
`find-file' will be used to visit a file.
|
|
|
|
|
|
|
|
|
|
`filesets-find-file' ... An alternative function that always uses
|
2007-09-19 15:16:31 +00:00
|
|
|
|
`find-file'. If `filesets-be-docile-flag' is true, a file, which isn't
|
2002-04-28 21:16:32 +00:00
|
|
|
|
readable, will not be opened.
|
|
|
|
|
|
|
|
|
|
Caveat: Changes will take effect only after rebuilding the menu."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type '(choice :tag "Function:"
|
|
|
|
|
(const :tag "filesets-find-or-display-file"
|
|
|
|
|
:value filesets-find-or-display-file)
|
|
|
|
|
(const :tag "filesets-find-file"
|
|
|
|
|
:value filesets-find-file)
|
|
|
|
|
(function :tag "Function"
|
|
|
|
|
:value nil))
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
2002-05-05 01:55:25 +00:00
|
|
|
|
(defcustom filesets-save-buffer-function 'save-buffer
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"The function used to save a buffer.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
Caveat: Changes will take effect after rebuilding the menu."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type '(choice :tag "Function:"
|
|
|
|
|
(const :tag "save-buffer"
|
|
|
|
|
:value save-buffer)
|
|
|
|
|
(function :tag "Function"
|
|
|
|
|
:value nil))
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-find-file-delay
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(if (and (featurep 'xemacs) gutter-buffers-tab-visible-p)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
0.5
|
|
|
|
|
0)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Delay before calling `find-file'.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
This is for calls via `filesets-find-or-display-file'
|
|
|
|
|
or `filesets-find-file'.
|
|
|
|
|
|
2012-02-28 08:17:21 +00:00
|
|
|
|
Set this to 0, if you don't use XEmacs's buffer tabs."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'number
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-be-docile-flag nil
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Non-nil means don't complain if a file or a directory doesn't exist.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
This is useful if you want to use the same startup files in different
|
|
|
|
|
computer environments."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-sort-menu-flag t
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Non-nil means sort the filesets menu alphabetically."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-sort-case-sensitive-flag t
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Non-nil means sorting of the filesets menu is case sensitive."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-tree-max-level 3
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Maximum scan depth for directory trees.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
A :tree fileset is defined by a base directory the contents of which
|
2002-05-05 01:55:25 +00:00
|
|
|
|
will be recursively added to the menu. `filesets-tree-max-level' tells up
|
2002-04-28 21:16:32 +00:00
|
|
|
|
to which level the directory structure should be scanned/listed,
|
|
|
|
|
i.e. how deep the menu should be. Try something like
|
|
|
|
|
|
|
|
|
|
\(\"HOME -- only one level\"
|
|
|
|
|
\(:tree \"~\" \"^[^.].*[^~]$\")
|
|
|
|
|
\(:tree-max-level 1)
|
|
|
|
|
\(:filter-dirs-flag t))
|
|
|
|
|
\(\"HOME -- up to 3 levels\"
|
|
|
|
|
\(:tree \"~\" \"^[^.].*[^~]$\")
|
|
|
|
|
\(:tree-max-level 3)
|
|
|
|
|
\(:filter-dirs-flag t))
|
|
|
|
|
|
|
|
|
|
and it should become clear what this option is about. In any case,
|
|
|
|
|
including directory trees to the menu can take a lot of memory."
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'filesets)
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-commands
|
2008-07-24 00:09:01 +00:00
|
|
|
|
`(("Isearch"
|
|
|
|
|
multi-isearch-files
|
|
|
|
|
(filesets-cmd-isearch-getargs))
|
|
|
|
|
("Isearch (regexp)"
|
|
|
|
|
multi-isearch-files-regexp
|
|
|
|
|
(filesets-cmd-isearch-getargs))
|
|
|
|
|
("Query Replace"
|
|
|
|
|
perform-replace
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(filesets-cmd-query-replace-getargs))
|
|
|
|
|
("Query Replace (regexp)"
|
2008-07-24 00:09:01 +00:00
|
|
|
|
perform-replace
|
|
|
|
|
(filesets-cmd-query-replace-regexp-getargs))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
("Grep <<selection>>"
|
|
|
|
|
"grep"
|
|
|
|
|
("-n " filesets-get-quoted-selection " " "<<file-name>>"))
|
|
|
|
|
("Run Shell Command"
|
|
|
|
|
filesets-cmd-shell-command
|
|
|
|
|
(filesets-cmd-shell-command-getargs)))
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Commands to run on filesets.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
An association list of names, functions, and an argument list (or a
|
|
|
|
|
function that returns one) to be run on a filesets' files.
|
|
|
|
|
|
|
|
|
|
The argument <file-name> or <<file-name>> (quoted) will be replaced with
|
|
|
|
|
the filename."
|
|
|
|
|
:set (function filesets-set-default+)
|
|
|
|
|
:type '(repeat :tag "Commands"
|
|
|
|
|
(list :tag "Definition" :value ("")
|
|
|
|
|
(string "Name")
|
|
|
|
|
(choice :tag "Command"
|
|
|
|
|
(string :tag "String")
|
|
|
|
|
(function :tag "Function"))
|
|
|
|
|
(repeat :tag "Argument List"
|
|
|
|
|
(choice :tag "Arguments"
|
|
|
|
|
(sexp :tag "Sexp"
|
|
|
|
|
:value nil)
|
|
|
|
|
(string :tag "File Name"
|
|
|
|
|
:value "<file-name>")
|
|
|
|
|
(string :tag "Quoted File Name"
|
|
|
|
|
:value "<<file-name>>")
|
|
|
|
|
(function :tag "Function"
|
|
|
|
|
:value nil)))))
|
|
|
|
|
:group 'filesets)
|
2002-05-05 01:55:25 +00:00
|
|
|
|
(put 'filesets-commands 'risky-local-variable t)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defcustom filesets-external-viewers
|
|
|
|
|
(let
|
2007-09-19 15:16:31 +00:00
|
|
|
|
;; ((ps-cmd (or (and (boundp 'my-ps-viewer) my-ps-viewer)
|
|
|
|
|
;; (filesets-select-command "ggv gv")))
|
|
|
|
|
;; (pdf-cmd (or (and (boundp 'my-ps-viewer) my-pdf-viewer)
|
|
|
|
|
;; (filesets-select-command "xpdf acroread")))
|
|
|
|
|
;; (dvi-cmd (or (and (boundp 'my-ps-viewer) my-dvi-viewer)
|
|
|
|
|
;; (filesets-select-command "xdvi tkdvi")))
|
|
|
|
|
;; (doc-cmd (or (and (boundp 'my-ps-viewer) my-doc-viewer)
|
|
|
|
|
;; (filesets-select-command "antiword")))
|
|
|
|
|
;; (pic-cmd (or (and (boundp 'my-ps-viewer) my-pic-viewer)
|
|
|
|
|
;; (filesets-select-command "gqview ee display"))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
((ps-cmd "ggv")
|
|
|
|
|
(pdf-cmd "xpdf")
|
|
|
|
|
(dvi-cmd "xdvi")
|
|
|
|
|
(doc-cmd "antiword")
|
|
|
|
|
(pic-cmd "gqview"))
|
|
|
|
|
`(("^.+\\..?html?$" browse-url
|
|
|
|
|
((:ignore-on-open-all t)))
|
|
|
|
|
("^.+\\.pdf$" ,pdf-cmd
|
|
|
|
|
((:ignore-on-open-all t)
|
|
|
|
|
(:ignore-on-read-text t)
|
|
|
|
|
(:constraint-flag ,pdf-cmd)))
|
|
|
|
|
("^.+\\.e?ps\\(.gz\\)?$" ,ps-cmd
|
|
|
|
|
((:ignore-on-open-all t)
|
|
|
|
|
(:ignore-on-read-text t)
|
|
|
|
|
(:constraint-flag ,ps-cmd)))
|
|
|
|
|
("^.+\\.dvi$" ,dvi-cmd
|
|
|
|
|
((:ignore-on-open-all t)
|
|
|
|
|
(:ignore-on-read-text t)
|
|
|
|
|
(:constraint-flag ,dvi-cmd)))
|
|
|
|
|
("^.+\\.doc$" ,doc-cmd
|
|
|
|
|
((:capture-output t)
|
|
|
|
|
(:ignore-on-read-text t)
|
|
|
|
|
(:constraint-flag ,doc-cmd)))
|
|
|
|
|
("^.+\\.\\(tiff\\|xpm\\|gif\\|pgn\\)$" ,pic-cmd
|
|
|
|
|
((:ignore-on-open-all t)
|
|
|
|
|
(:ignore-on-read-text t)
|
|
|
|
|
(:constraint-flag ,pic-cmd)))))
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Association list of file patterns and external viewers for use with
|
2002-04-28 21:16:32 +00:00
|
|
|
|
`filesets-find-or-display-file'.
|
|
|
|
|
|
|
|
|
|
Has the form ((FILE-PATTERN VIEWER PROPERTIES) ...), VIEWER being either a
|
|
|
|
|
function or a command name as string.
|
|
|
|
|
|
2005-06-10 14:02:49 +00:00
|
|
|
|
Properties is an association list determining filesets' behavior in
|
|
|
|
|
several conditions. Choose one from this list:
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
:ignore-on-open-all ... Don't open files of this type automatically --
|
|
|
|
|
i.e. on open-all-files-events or when running commands
|
|
|
|
|
|
|
|
|
|
:capture-output ... capture an external viewer output
|
|
|
|
|
|
|
|
|
|
:constraintp FUNCTION ... use this viewer only if FUNCTION returns non-nil
|
|
|
|
|
|
2002-05-07 16:11:30 +00:00
|
|
|
|
:constraint-flag SEXP ... use this viewer only if SEXP evaluates to non-nil
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
:open-hook HOOK ... run hooks after spawning the viewer -- mainly useful
|
|
|
|
|
in conjunction with :capture-output
|
|
|
|
|
|
|
|
|
|
:args (FORMAT-STRING or SYMBOL or FUNCTION) ... a list of arguments
|
|
|
|
|
\(defaults to (list \"%S\")) when using shell commands
|
|
|
|
|
|
|
|
|
|
Avoid modifying this variable and achieve minor speed-ups by setting the
|
|
|
|
|
variables my-ps-viewer, my-pdf-viewer, my-dvi-viewer, my-pic-viewer.
|
|
|
|
|
|
|
|
|
|
In order to view pdf or rtf files in an Emacs buffer, you could use these:
|
|
|
|
|
|
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
\(\"^.+\\\\.pdf\\\\'\" \"pdftotext\"
|
2002-04-28 21:16:32 +00:00
|
|
|
|
\((:capture-output t)
|
|
|
|
|
\(:args (\"%S - | fmt -w \" window-width))
|
|
|
|
|
\(:ignore-on-read-text t)
|
|
|
|
|
\(:constraintp (lambda ()
|
|
|
|
|
\(and \(filesets-which-command-p \"pdftotext\")
|
|
|
|
|
\(filesets-which-command-p \"fmt\"))))))
|
2007-09-19 15:16:31 +00:00
|
|
|
|
\(\"^.+\\\\.rtf\\\\'\" \"rtf2htm\"
|
2002-04-28 21:16:32 +00:00
|
|
|
|
\((:capture-output t)
|
|
|
|
|
\(:args (\"%S 2> /dev/null | w3m -dump -T text/html\"))
|
|
|
|
|
\(:ignore-on-read-text t)
|
|
|
|
|
\(:constraintp (lambda ()
|
|
|
|
|
\(and (filesets-which-command-p \"rtf2htm\")
|
2007-09-19 15:16:31 +00:00
|
|
|
|
\(filesets-which-command-p \"w3m\"))))))"
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type '(repeat :tag "Viewer"
|
|
|
|
|
(list :tag "Definition"
|
|
|
|
|
:value ("^.+\\.suffix$" "")
|
|
|
|
|
(regexp :tag "Pattern")
|
|
|
|
|
(choice :tag "Viewer"
|
|
|
|
|
(symbol :tag "Function" :value nil)
|
|
|
|
|
(string :tag "Program" :value ""))
|
|
|
|
|
(repeat :tag "Properties"
|
|
|
|
|
(choice
|
|
|
|
|
(list :tag ":constraintp"
|
|
|
|
|
:value (:constraintp)
|
|
|
|
|
(const :format ""
|
|
|
|
|
:value :constraintp)
|
|
|
|
|
(function :tag "Function"))
|
|
|
|
|
(list :tag ":constraint-flag"
|
|
|
|
|
:value (:constraint-flag)
|
|
|
|
|
(const :format ""
|
|
|
|
|
:value :constraint-flag)
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(sexp :tag "Symbol"))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(list :tag ":ignore-on-open-all"
|
|
|
|
|
:value (:ignore-on-open-all t)
|
|
|
|
|
(const :format ""
|
|
|
|
|
:value :ignore-on-open-all)
|
|
|
|
|
(boolean :tag "Boolean"))
|
|
|
|
|
(list :tag ":ignore-on-read-text"
|
|
|
|
|
:value (:ignore-on-read-text t)
|
|
|
|
|
(const :format ""
|
|
|
|
|
:value :ignore-on-read-text)
|
|
|
|
|
(boolean :tag "Boolean"))
|
|
|
|
|
(list :tag ":args"
|
|
|
|
|
:value (:args)
|
|
|
|
|
(const :format ""
|
|
|
|
|
:value :args)
|
|
|
|
|
(repeat :tag "List"
|
|
|
|
|
(choice :tag "Arguments"
|
|
|
|
|
(string :tag "String"
|
|
|
|
|
:value "")
|
|
|
|
|
(symbol :tag "Symbol"
|
|
|
|
|
:value nil)
|
|
|
|
|
(function :tag "Function"
|
|
|
|
|
:value nil))))
|
|
|
|
|
(list :tag ":open-hook"
|
|
|
|
|
:value (:open-hook)
|
|
|
|
|
(const :format ""
|
|
|
|
|
:value :open-hook)
|
|
|
|
|
(hook :tag "Hook"))
|
|
|
|
|
; (list :tag ":close-hook"
|
|
|
|
|
; :value (:close-hook)
|
|
|
|
|
; (const :format ""
|
|
|
|
|
; :value :close-hook)
|
|
|
|
|
; (hook :tag "Hook"))
|
|
|
|
|
(list :tag ":capture-output"
|
|
|
|
|
:value (:capture-output t)
|
|
|
|
|
(const :format ""
|
|
|
|
|
:value :capture-output)
|
|
|
|
|
(boolean :tag "Boolean"))))))
|
|
|
|
|
:group 'filesets)
|
2002-05-05 01:55:25 +00:00
|
|
|
|
(put 'filesets-external-viewers 'risky-local-variable t)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defcustom filesets-ingroup-patterns
|
|
|
|
|
'(("^.+\\.tex$" t
|
|
|
|
|
(((:name "Package")
|
|
|
|
|
(:pattern "\\\\usepackage\\W*\\(\\[[^\]]*\\]\\W*\\)?{\\W*\\(.+\\)\\W*}")
|
|
|
|
|
(:match-number 2)
|
|
|
|
|
(:stub-flag t)
|
|
|
|
|
(:get-file-name (lambda (master file)
|
|
|
|
|
(filesets-which-file master
|
|
|
|
|
(concat file ".sty")
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(filesets-convert-path-list
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(or (getenv "MY_TEXINPUTS")
|
|
|
|
|
(getenv "TEXINPUTS")))))))
|
|
|
|
|
((:name "Include")
|
|
|
|
|
(:pattern "\\\\include\\W*{\\W*\\(.+\\)\\W*}")
|
|
|
|
|
(:get-file-name (lambda (master file)
|
|
|
|
|
(filesets-which-file master
|
|
|
|
|
(concat file ".tex")
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(filesets-convert-path-list
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(or (getenv "MY_TEXINPUTS")
|
|
|
|
|
(getenv "TEXINPUTS"))))))
|
|
|
|
|
(:scan-depth 5))
|
|
|
|
|
((:name "Input")
|
|
|
|
|
(:pattern "\\\\input\\W*{\\W*\\(.+\\)\\W*}")
|
|
|
|
|
(:stubp (lambda (a b) (not (filesets-files-in-same-directory-p a b))))
|
|
|
|
|
(:get-file-name (lambda (master file)
|
|
|
|
|
(filesets-which-file master
|
|
|
|
|
(concat file ".tex")
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(filesets-convert-path-list
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(or (getenv "MY_TEXINPUTS")
|
|
|
|
|
(getenv "TEXINPUTS"))))))
|
|
|
|
|
(:scan-depth 5))
|
|
|
|
|
((:name "Bibliography")
|
|
|
|
|
(:pattern "\\\\bibliography\\W*{\\W*\\(.+\\)\\W*}")
|
|
|
|
|
(:get-file-name (lambda (master file)
|
|
|
|
|
(filesets-which-file master
|
|
|
|
|
(concat file ".bib")
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(filesets-convert-path-list
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(or (getenv "MY_BIBINPUTS")
|
|
|
|
|
(getenv "BIBINPUTS")))))))))
|
|
|
|
|
("^.+\\.el$" t
|
|
|
|
|
(((:name "Require")
|
|
|
|
|
(:pattern "(require\\W+'\\(.+\\))")
|
|
|
|
|
(:stubp (lambda (a b) (not (filesets-files-in-same-directory-p a b))))
|
|
|
|
|
(:get-file-name (lambda (master file)
|
|
|
|
|
(filesets-which-file master
|
|
|
|
|
(concat file ".el")
|
|
|
|
|
load-path))))
|
|
|
|
|
((:name "Load")
|
|
|
|
|
(:pattern "(load\\(-library\\)?\\W+\"\\(.+\\)\")")
|
|
|
|
|
(:match-number 2)
|
|
|
|
|
(:get-file-name (lambda (master file)
|
|
|
|
|
(filesets-which-file master file load-path))))))
|
2013-03-05 17:13:01 +00:00
|
|
|
|
("^\\([A-ZÄÖÜ][a-zäöüß]+\\([A-ZÄÖÜ][a-zäöüß]+\\)+\\)$" t
|
|
|
|
|
(((:pattern "\\<\\([A-ZÄÖÜ][a-zäöüß]+\\([A-ZÄÖÜ][a-zäöüß]+\\)+\\)\\>")
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(:scan-depth 5)
|
|
|
|
|
(:stubp (lambda (a b) (not (filesets-files-in-same-directory-p a b))))
|
|
|
|
|
(:case-sensitive t)
|
|
|
|
|
(:get-file-name (lambda (master file)
|
|
|
|
|
(filesets-which-file
|
|
|
|
|
master
|
|
|
|
|
file
|
|
|
|
|
(if (boundp 'emacs-wiki-directories)
|
|
|
|
|
emacs-wiki-directories
|
|
|
|
|
nil))))))))
|
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Inclusion group definitions.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
Define how to find included file according to a file's mode (being
|
|
|
|
|
defined by a file pattern).
|
|
|
|
|
|
|
|
|
|
A valid entry has the form (FILE-PATTERN REMOVE-DUPLICATES-FLAG
|
|
|
|
|
CMD-DEF1 ...), CMD-DEF1 being a plist containing the fields :pattern
|
|
|
|
|
\(mandatory), :name, :get-file-name, :match-number, :scan-depth,
|
|
|
|
|
:preprocess, :case-sensitive.
|
|
|
|
|
|
|
|
|
|
File Pattern ... A regexp matching the file's name for which the
|
|
|
|
|
following rules should be applied.
|
|
|
|
|
|
|
|
|
|
Remove Duplicates ... If t, only the first occurrence of an included
|
|
|
|
|
file is retained. (See below for a full explanation.)
|
|
|
|
|
|
|
|
|
|
:name STRING ... This pattern's name.
|
|
|
|
|
|
|
|
|
|
:pattern REGEXP ... A regexp matching the command. This regexp has to
|
|
|
|
|
include a group that holds the name of the included file.
|
|
|
|
|
|
|
|
|
|
:get-file-name FUNCTION (default: `filesets-which-file') ... A function
|
|
|
|
|
that takes two arguments (the path of the master file and the name
|
|
|
|
|
of the included file) and returns a valid path or nil -- if the
|
|
|
|
|
subfile can't be found.
|
|
|
|
|
|
|
|
|
|
:match-number INTEGER (default: 1) ... The number of the match/group
|
|
|
|
|
in the pattern holding the subfile's name. 0 refers the whole
|
|
|
|
|
match, 1 to the first group.
|
|
|
|
|
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
:stubp FUNCTION ... If (FUNCTION MASTER INCLUDED-FILE) returns non-nil,
|
2002-04-28 21:16:32 +00:00
|
|
|
|
INCLUDED-FILE is a stub -- see below.
|
|
|
|
|
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
:stub-flag ... Files of this type are stubs -- see below.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
:scan-depth INTEGER (default: 0) ... Whether included files should be
|
|
|
|
|
rescanned. Set this to 0 to disable re-scanning of included file.
|
|
|
|
|
|
|
|
|
|
:preprocess FUNCTION ... A function modifying a buffer holding the
|
|
|
|
|
master file so that pattern matching becomes easier. This is usually
|
|
|
|
|
used to narrow a buffer to the relevant region. This function could also
|
|
|
|
|
be destructive and simply delete non-relevant text.
|
|
|
|
|
|
|
|
|
|
:case-sensitive BOOLEAN (default: nil) ... Whether a pattern is
|
|
|
|
|
case-sensitive or not.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Stubs:
|
|
|
|
|
|
|
|
|
|
First, a stub is a file that shows up in the menu but will not be
|
|
|
|
|
included in an ingroup's file listing -- i.e. filesets will never
|
2007-09-19 15:16:31 +00:00
|
|
|
|
operate on this file automatically. Secondly, in opposition to normal
|
|
|
|
|
files stubs are not scanned for new inclusion groups. This is useful if
|
2002-04-28 21:16:32 +00:00
|
|
|
|
you want to have quick access to library headers.
|
|
|
|
|
|
|
|
|
|
In the menu, an asterisk is appended to the stub's name.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Remove Duplicates:
|
|
|
|
|
|
|
|
|
|
E.g. File A and file B refer to file X; X refers to A. If
|
|
|
|
|
you choose not to remove duplicates the tree would look like:
|
|
|
|
|
|
|
|
|
|
M + A - X - A ...
|
|
|
|
|
B - X - A ...
|
|
|
|
|
|
|
|
|
|
As you can see, there is some chance that you run in circles.
|
|
|
|
|
Nevertheless, up to some degree this could still be what you want.
|
|
|
|
|
|
|
|
|
|
With duplicates removed, it would be:
|
|
|
|
|
|
|
|
|
|
M + A - X
|
|
|
|
|
B"
|
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type '(repeat
|
|
|
|
|
:tag "Include"
|
|
|
|
|
(list
|
|
|
|
|
:tag "Definition" :value ("^.+\\.suffix$" t)
|
|
|
|
|
(regexp :tag "File Pattern" :value "^.+\\.suffix$")
|
|
|
|
|
(boolean :tag "Remove Duplicates" :value t)
|
|
|
|
|
(repeat :tag "Commands"
|
|
|
|
|
(repeat :tag "Command"
|
|
|
|
|
(choice
|
|
|
|
|
:tag "Definition"
|
|
|
|
|
(list :tag ":name"
|
|
|
|
|
:value (:name "")
|
|
|
|
|
(const :format "" :value :name)
|
|
|
|
|
(string :tag "String"))
|
|
|
|
|
(list :tag ":pattern"
|
|
|
|
|
:value (:pattern "\\<CMD\\W*\\(.+\\)\\>")
|
|
|
|
|
(const :format "" :value :pattern)
|
|
|
|
|
(regexp :tag "RegExp"))
|
|
|
|
|
(list :tag ":get-file-name"
|
|
|
|
|
:value (:get-file-name)
|
|
|
|
|
(const :format "" :value :get-file-name)
|
|
|
|
|
(function :tag "Function"))
|
|
|
|
|
(list :tag ":match-number"
|
|
|
|
|
:value (:match-number 1)
|
|
|
|
|
(const :format "" :value :match-number)
|
|
|
|
|
(integer :tag "Integer"))
|
|
|
|
|
(list :tag ":stub-flag"
|
|
|
|
|
:value (:stub-flag t)
|
|
|
|
|
(const :format "" :value :stub-flag)
|
|
|
|
|
(boolean :tag "Boolean"))
|
|
|
|
|
(list :tag ":stubp"
|
|
|
|
|
:value (:stubp)
|
|
|
|
|
(const :format "" :value :stubp)
|
|
|
|
|
(function :tag "Function"))
|
|
|
|
|
(list :tag ":scan-depth"
|
|
|
|
|
:value (:scan-depth 0)
|
|
|
|
|
(const :format "" :value :scan-depth)
|
|
|
|
|
(integer :tag "Integer"))
|
|
|
|
|
(list :tag ":case-sensitive"
|
|
|
|
|
:value (:case-sensitive)
|
|
|
|
|
(const :format "" :value :case-sensitive)
|
|
|
|
|
(boolean :tag "Boolean"))
|
|
|
|
|
(list :tag ":preprocess"
|
|
|
|
|
:value (:preprocess)
|
|
|
|
|
(const :format "" :value :preprocess)
|
|
|
|
|
(function :tag "Function")))))))
|
|
|
|
|
:group 'filesets)
|
2002-05-05 01:55:25 +00:00
|
|
|
|
(put 'filesets-ingroup-patterns 'risky-local-variable t)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(defcustom filesets-data nil
|
|
|
|
|
"Fileset definitions.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
A fileset is either a list of files, a file pattern, a base directory
|
|
|
|
|
and a search pattern (for files), or a base file. Changes to this
|
|
|
|
|
variable will take effect after rebuilding the menu.
|
|
|
|
|
|
|
|
|
|
Caveat: Fileset names have to be unique.
|
|
|
|
|
|
|
|
|
|
Example definition:
|
|
|
|
|
'\(\(\"My Wiki\"
|
|
|
|
|
\(:ingroup \"~/Etc/My-Wiki/WikiContents\"))
|
|
|
|
|
\(\"My Homepage\"
|
|
|
|
|
\(:pattern \"~/public_html/\" \"^.+\\\\.html$\")
|
|
|
|
|
\(:open filesets-find-file))
|
|
|
|
|
\(\"User Configuration\"
|
|
|
|
|
\(:files \"~/.xinitrc\"
|
|
|
|
|
\"~/.bashrc\"
|
|
|
|
|
\"~/.bash_profile\"))
|
|
|
|
|
\(\"HOME\"
|
|
|
|
|
\(:tree \"~\" \"^[^.].*[^~]$\")
|
|
|
|
|
\(:filter-dirs-flag t)))
|
|
|
|
|
|
|
|
|
|
`filesets-data' is a list of (NAME-AS-STRING . DEFINITION), DEFINITION
|
|
|
|
|
being an association list with the fields:
|
|
|
|
|
|
|
|
|
|
:files FILE-1 .. FILE-N ... a list of files belonging to a fileset
|
|
|
|
|
|
|
|
|
|
:ingroup FILE-NAME ... an inclusion group's base file.
|
|
|
|
|
|
|
|
|
|
:tree ROOT-DIR PATTERN ... a base directory and a file pattern
|
|
|
|
|
|
2008-10-23 22:31:15 +00:00
|
|
|
|
:pattern DIR PATTERN ... a base directory and a regexp matching
|
|
|
|
|
files in that directory. Usually,
|
|
|
|
|
PATTERN has the form '^REGEXP$'. Unlike
|
|
|
|
|
:tree, this form does not descend
|
|
|
|
|
recursively into subdirectories.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
:filter-dirs-flag BOOLEAN ... is only used in conjunction with :tree.
|
|
|
|
|
|
|
|
|
|
:tree-max-level INTEGER ... recurse into directories this many levels
|
2002-04-29 08:48:34 +00:00
|
|
|
|
\(see `filesets-tree-max-level' for a full explanation)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
:dormant-flag BOOLEAN ... non-nil means don't show this item in the
|
|
|
|
|
menu; dormant filesets can still be manipulated via commands available
|
|
|
|
|
from the minibuffer -- e.g. `filesets-open', `filesets-close', or
|
|
|
|
|
`filesets-run-cmd'
|
|
|
|
|
|
|
|
|
|
:dormant-p FUNCTION ... a function returning :dormant-flag
|
|
|
|
|
|
|
|
|
|
:open FUNCTION ... the function used to open file belonging to this
|
|
|
|
|
fileset. The function takes a file name as argument
|
|
|
|
|
|
|
|
|
|
:save FUNCTION ... the function used to save file belonging to this
|
|
|
|
|
fileset; it takes no arguments, but works on the current buffer.
|
|
|
|
|
|
|
|
|
|
Either :files, :pattern, :tree, or :ingroup must be supplied. :files
|
|
|
|
|
overrules :tree, :tree overrules :pattern, :pattern overrules :ingroup,
|
|
|
|
|
i.e. these tags are mutually exclusive. The fields :open and :save are
|
|
|
|
|
optional.
|
|
|
|
|
|
|
|
|
|
In conjunction with the :tree tag, :save is void. :open refers to the
|
|
|
|
|
function used for opening files in a directory, not for opening the
|
2002-05-05 01:55:25 +00:00
|
|
|
|
directory. For browsing directories, `filesets-browse-dir-function' is used.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
Before using :ingroup, make sure that the file type is already
|
|
|
|
|
defined in `filesets-ingroup-patterns'."
|
|
|
|
|
:group 'filesets
|
|
|
|
|
:set (function filesets-data-set-default)
|
|
|
|
|
:type '(repeat
|
|
|
|
|
(cons :tag "Fileset"
|
|
|
|
|
(string :tag "Name" :value "")
|
|
|
|
|
(repeat :tag "Data"
|
|
|
|
|
(choice
|
|
|
|
|
:tag "Type" :value nil
|
|
|
|
|
(list :tag "Pattern"
|
|
|
|
|
:value (:pattern "~/" "^.+\\.suffix$")
|
|
|
|
|
(const :format "" :value :pattern)
|
|
|
|
|
(directory :tag "Dir")
|
|
|
|
|
(regexp :tag "Pattern"))
|
|
|
|
|
(cons :tag "Files"
|
|
|
|
|
:value (:files)
|
|
|
|
|
(const :format "" :value :files)
|
|
|
|
|
(repeat :tag "Files" file))
|
|
|
|
|
(list :tag "Single File"
|
|
|
|
|
:value (:file "~/")
|
|
|
|
|
(const :format "" :value :file)
|
|
|
|
|
(file :tag "File"))
|
|
|
|
|
(list :tag "Inclusion group"
|
|
|
|
|
:value (:ingroup "~/")
|
|
|
|
|
(const :format "" :value :ingroup)
|
|
|
|
|
(file :tag "File" :value "~/"))
|
|
|
|
|
(list :tag "Directory Tree"
|
|
|
|
|
:value (:tree "~/" "^.+\\.suffix$")
|
|
|
|
|
(const :format "" :value :tree)
|
|
|
|
|
(directory :tag "Dir")
|
|
|
|
|
(regexp :tag "Pattern"))
|
|
|
|
|
(list :tag "Filter directories"
|
|
|
|
|
:value (:filter-dirs-flag)
|
|
|
|
|
(const :format "" :value :filter-dirs-flag)
|
|
|
|
|
(boolean :tag "Boolean" :value nil))
|
|
|
|
|
(list :tag "Scanning depth"
|
|
|
|
|
:value (:tree-max-level 3)
|
|
|
|
|
(const :format "" :value :tree-max-level)
|
|
|
|
|
(integer :tag "Integer"))
|
|
|
|
|
(list :tag "Verbosity"
|
|
|
|
|
:value (:verbosity 1)
|
|
|
|
|
(const :format "" :value :verbosity)
|
|
|
|
|
(integer :tag "Integer"))
|
|
|
|
|
(list :tag "Conceal fileset (Flag)"
|
|
|
|
|
:value (:dormant-flag)
|
|
|
|
|
(const :format "" :value :dormant-flag)
|
|
|
|
|
(boolean :tag "Boolean"))
|
|
|
|
|
(list :tag "Conceal fileset (Function)"
|
|
|
|
|
:value (:dormant-p)
|
|
|
|
|
(const :format "" :value :dormant-p)
|
|
|
|
|
(function :tag "Function"))
|
|
|
|
|
(list :tag "Save function"
|
|
|
|
|
:value (:save)
|
|
|
|
|
(const :format "" :value :save)
|
|
|
|
|
(function :tag "Function"))
|
|
|
|
|
(list :tag "Open function"
|
|
|
|
|
:value (:open)
|
|
|
|
|
(const :format "" :value :open)
|
|
|
|
|
(function :tag "Function")))))))
|
2002-05-05 01:55:25 +00:00
|
|
|
|
(put 'filesets-data 'risky-local-variable t)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defcustom filesets-query-user-limit 15
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Query the user before opening a fileset with that many files."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:set (function filesets-set-default)
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'filesets)
|
2003-05-03 13:48:39 +00:00
|
|
|
|
|
2002-04-28 21:16:32 +00:00
|
|
|
|
;;; Emacs compatibility
|
|
|
|
|
(eval-and-compile
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(if (featurep 'xemacs)
|
2005-03-30 15:14:55 +00:00
|
|
|
|
(fset 'filesets-error 'error)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2002-04-30 01:59:00 +00:00
|
|
|
|
(require 'easymenu)
|
2003-01-27 08:44:27 +00:00
|
|
|
|
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(defun filesets-error (_class &rest args)
|
2002-04-30 01:59:00 +00:00
|
|
|
|
"`error' wrapper."
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(error "%s" (mapconcat 'identity args " ")))
|
2002-04-30 01:59:00 +00:00
|
|
|
|
|
|
|
|
|
))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-filter-dir-names (lst &optional negative)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Remove non-directory names from a list of strings.
|
|
|
|
|
If NEGATIVE is non-nil, remove all directory names."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(filesets-filter-list lst
|
|
|
|
|
(lambda (x)
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(and (not (string-match-p "^\\.+/$" x))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(if negative
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(not (string-match-p "[:/\\]$" x))
|
|
|
|
|
(string-match-p "[:/\\]$" x))))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(defun filesets-conditional-sort (lst &optional access-fn)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
"Return a sorted copy of LST, LST being a list of strings.
|
|
|
|
|
If `filesets-sort-menu-flag' is nil, return LST itself.
|
|
|
|
|
|
2007-10-15 17:24:36 +00:00
|
|
|
|
ACCESS-FN ... function to get the string value of LST's elements."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(if filesets-sort-menu-flag
|
|
|
|
|
(let* ((fni (or access-fn
|
|
|
|
|
(function identity)))
|
|
|
|
|
(fn (if filesets-sort-case-sensitive-flag
|
|
|
|
|
(lambda (a b)
|
|
|
|
|
(string< (funcall fni a)
|
|
|
|
|
(funcall fni b)))
|
|
|
|
|
(lambda (a b)
|
|
|
|
|
(string< (upcase (funcall fni a))
|
|
|
|
|
(upcase (funcall fni b)))))))
|
2002-05-08 15:54:59 +00:00
|
|
|
|
(sort (copy-sequence lst) fn))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
lst))
|
|
|
|
|
|
|
|
|
|
(defun filesets-directory-files (dir &optional
|
|
|
|
|
pattern what full-flag match-dirs-flag)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Get WHAT (:files or :dirs) in DIR.
|
|
|
|
|
If PATTERN is provided return only those entries matching this
|
|
|
|
|
regular expression.
|
|
|
|
|
If MATCH-DIRS-FLAG is non-nil, also match directory entries.
|
|
|
|
|
Return full path if FULL-FLAG is non-nil."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(filesets-message 2 "Filesets: scanning %S" dir)
|
|
|
|
|
(cond
|
|
|
|
|
((file-exists-p dir)
|
|
|
|
|
(let ((files nil)
|
|
|
|
|
(dirs nil))
|
|
|
|
|
(dolist (this (file-name-all-completions "" dir))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(cond
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
((string-match-p "^\\.+/$" this)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
nil)
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
((string-match-p "[:/\\]$" this)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(when (or (not match-dirs-flag)
|
|
|
|
|
(not pattern)
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(string-match-p pattern this))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(filesets-message 5 "Filesets: matched dir %S with pattern %S"
|
2002-04-28 21:16:32 +00:00
|
|
|
|
this pattern)
|
|
|
|
|
(setq dirs (cons this dirs))))
|
|
|
|
|
(t
|
|
|
|
|
(when (or (not pattern)
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(string-match-p pattern this))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(filesets-message 5 "Filesets: matched file %S with pattern %S"
|
2002-04-28 21:16:32 +00:00
|
|
|
|
this pattern)
|
|
|
|
|
(setq files (cons (if full-flag
|
|
|
|
|
(concat (file-name-as-directory dir) this)
|
|
|
|
|
this)
|
|
|
|
|
files))))))
|
|
|
|
|
(cond
|
|
|
|
|
((equal what ':dirs)
|
|
|
|
|
(filesets-conditional-sort dirs))
|
|
|
|
|
((equal what ':files)
|
|
|
|
|
(filesets-conditional-sort files))
|
|
|
|
|
(t
|
|
|
|
|
(append (filesets-conditional-sort files)
|
|
|
|
|
(filesets-conditional-sort dirs))))))
|
|
|
|
|
(filesets-be-docile-flag
|
|
|
|
|
(filesets-message 1 "Filesets: %S doesn't exist" dir)
|
|
|
|
|
nil)
|
|
|
|
|
(t
|
|
|
|
|
(filesets-error 'error "Filesets: " dir " does not exist"))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-quote (txt)
|
|
|
|
|
"Return TXT in quotes."
|
|
|
|
|
(concat "\"" txt "\""))
|
|
|
|
|
|
|
|
|
|
(defun filesets-get-selection ()
|
|
|
|
|
"Get the text between mark and point -- i.e. the selection or region."
|
|
|
|
|
(let ((m (mark))
|
|
|
|
|
(p (point)))
|
|
|
|
|
(if m
|
|
|
|
|
(buffer-substring (min m p) (max m p))
|
|
|
|
|
(filesets-error 'error "No selection."))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-get-quoted-selection ()
|
|
|
|
|
"Return the currently selected text in quotes."
|
|
|
|
|
(filesets-quote (filesets-get-selection)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-get-shortcut (n)
|
|
|
|
|
"Create menu shortcuts based on number N."
|
|
|
|
|
(let ((n (mod (- n 1) 51)))
|
|
|
|
|
(cond
|
|
|
|
|
((not filesets-menu-shortcuts-flag)
|
|
|
|
|
"")
|
|
|
|
|
((<= n 9)
|
|
|
|
|
(concat (number-to-string n) " "))
|
|
|
|
|
((<= n 35)
|
|
|
|
|
(format "%c " (+ 87 n)))
|
|
|
|
|
((<= n 51)
|
|
|
|
|
(format "%c " (+ -3 n))))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-files-equalp (a b)
|
|
|
|
|
"Compare two filenames A and B after expansion."
|
|
|
|
|
(equal (expand-file-name a) (expand-file-name b)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-files-in-same-directory-p (a b)
|
|
|
|
|
"Compare two filenames A and B after expansion."
|
|
|
|
|
(let ((ad (file-name-directory (expand-file-name a)))
|
|
|
|
|
(bd (file-name-directory (expand-file-name b))))
|
|
|
|
|
(equal ad bd)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-convert-path-list (string)
|
|
|
|
|
"Return a path-list given as STRING as list."
|
|
|
|
|
(if string
|
|
|
|
|
(mapcar (lambda (x) (file-name-as-directory x))
|
|
|
|
|
(split-string string path-separator))
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
(defun filesets-which-file (master filename &optional path-list)
|
|
|
|
|
"Search for a FILENAME relative to a MASTER file in PATH-LIST."
|
|
|
|
|
(let ((f (concat (file-name-directory master)
|
|
|
|
|
filename)))
|
|
|
|
|
(if (file-exists-p f)
|
|
|
|
|
f
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(filesets-some
|
|
|
|
|
(lambda (dir)
|
|
|
|
|
(let ((dir (file-name-as-directory dir))
|
|
|
|
|
(files (if (file-exists-p dir)
|
|
|
|
|
(filesets-directory-files dir nil ':files)
|
|
|
|
|
nil)))
|
|
|
|
|
(filesets-some (lambda (file)
|
|
|
|
|
(if (equal filename (file-name-nondirectory file))
|
|
|
|
|
(concat dir file)
|
|
|
|
|
nil))
|
|
|
|
|
files)))
|
|
|
|
|
path-list))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun filesets-eviewer-get-props (entry)
|
|
|
|
|
"Get ENTRY's (representing an external viewer) properties."
|
|
|
|
|
(nth 2 entry))
|
|
|
|
|
|
|
|
|
|
(defun filesets-eviewer-constraint-p (entry)
|
|
|
|
|
(let* ((props (filesets-eviewer-get-props entry))
|
|
|
|
|
(constraint (assoc ':constraintp props))
|
|
|
|
|
(constraint-flag (assoc ':constraint-flag props)))
|
|
|
|
|
(cond
|
|
|
|
|
(constraint
|
|
|
|
|
(funcall (cadr constraint)))
|
|
|
|
|
(constraint-flag
|
|
|
|
|
(eval (cadr constraint-flag)))
|
|
|
|
|
(t
|
|
|
|
|
t))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-get-external-viewer (file)
|
|
|
|
|
"Find an external viewer for FILE."
|
|
|
|
|
(let ((filename (file-name-nondirectory file)))
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(filesets-some
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(lambda (entry)
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(when (and (string-match-p (nth 0 entry) filename)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(filesets-eviewer-constraint-p entry))
|
|
|
|
|
entry))
|
|
|
|
|
filesets-external-viewers)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-get-external-viewer-by-name (name)
|
|
|
|
|
"Get the external viewer definition called NAME."
|
|
|
|
|
(when name
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(filesets-some
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(lambda (entry)
|
|
|
|
|
(when (and (string-equal (nth 1 entry) name)
|
|
|
|
|
(filesets-eviewer-constraint-p entry))
|
|
|
|
|
entry))
|
|
|
|
|
filesets-external-viewers)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-filetype-property (filename event &optional entry)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Return non-nil if a file of a specific type has special flags/tags.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
Events (corresponding tag):
|
|
|
|
|
|
|
|
|
|
on-open-all (:ignore-on-open-all) ... Exclude files of this when opening
|
|
|
|
|
a fileset
|
|
|
|
|
|
|
|
|
|
on-grep (:ignore-on-read-text) ... Exclude files of this when running
|
|
|
|
|
the \"Grep <<selection>>\" command
|
|
|
|
|
|
|
|
|
|
on-capture-output (:capture-output) ... Capture output of an external viewer
|
|
|
|
|
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
on-ls ... Not used
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
on-cmd ... Not used
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
on-close-all ... Not used"
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((def (filesets-eviewer-get-props
|
|
|
|
|
(or entry
|
|
|
|
|
(filesets-get-external-viewer filename)))))
|
|
|
|
|
(filesets-alist-get def
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(pcase event
|
|
|
|
|
(`on-open-all ':ignore-on-open-all)
|
|
|
|
|
(`on-grep ':ignore-on-read-text)
|
|
|
|
|
(`on-cmd nil)
|
|
|
|
|
(`on-close-all nil))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
nil t)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-filetype-get-prop (property filename &optional entry)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Return PROPERTY for filename -- use ENTRY if provided."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((def (filesets-eviewer-get-props
|
|
|
|
|
(or entry
|
|
|
|
|
(filesets-get-external-viewer filename)))))
|
|
|
|
|
(when def
|
|
|
|
|
(filesets-alist-get def property nil t))))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(defun filesets-reset-filename-on-change ()
|
|
|
|
|
"Reset a buffer's filename if the buffer is being modified."
|
|
|
|
|
(when filesets-output-buffer-flag
|
|
|
|
|
(set-visited-file-name nil t)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-spawn-external-viewer (file &optional ev-entry)
|
|
|
|
|
"Start an external viewer for FILE.
|
|
|
|
|
Use the viewer defined in EV-ENTRY (a valid element of
|
|
|
|
|
`filesets-external-viewers') if provided."
|
|
|
|
|
(let* ((file (expand-file-name file))
|
|
|
|
|
(entry (or ev-entry
|
|
|
|
|
(filesets-get-external-viewer file))))
|
|
|
|
|
(if entry
|
|
|
|
|
(let* ((vwr (cadr entry))
|
|
|
|
|
(co-flag (filesets-filetype-get-prop ':capture-output file entry))
|
|
|
|
|
(oh (filesets-filetype-get-prop ':open-hook file entry))
|
|
|
|
|
(args (let ((fmt (filesets-filetype-get-prop ':args file entry)))
|
|
|
|
|
(if fmt
|
|
|
|
|
(let ((rv ""))
|
|
|
|
|
(dolist (this fmt rv)
|
|
|
|
|
(setq rv (concat rv
|
|
|
|
|
(cond
|
|
|
|
|
((stringp this)
|
|
|
|
|
(format this file))
|
|
|
|
|
((and (symbolp this)
|
|
|
|
|
(fboundp this))
|
|
|
|
|
(format "%S" (funcall this)))
|
|
|
|
|
(t
|
|
|
|
|
(format "%S" this)))))))
|
|
|
|
|
(format "%S" file))))
|
|
|
|
|
(output
|
|
|
|
|
(cond
|
|
|
|
|
((and (functionp vwr) co-flag)
|
|
|
|
|
(funcall vwr file))
|
|
|
|
|
((functionp vwr)
|
|
|
|
|
(funcall vwr file)
|
|
|
|
|
nil)
|
|
|
|
|
(co-flag
|
|
|
|
|
(shell-command-to-string (format "%s %s" vwr args)))
|
|
|
|
|
(t
|
|
|
|
|
(shell-command (format "%s %s&" vwr args))
|
|
|
|
|
nil))))
|
|
|
|
|
(if co-flag
|
|
|
|
|
(progn
|
|
|
|
|
(switch-to-buffer (format "Filesets: %s %s" vwr file))
|
|
|
|
|
(insert output)
|
|
|
|
|
(make-local-variable 'filesets-output-buffer-flag)
|
|
|
|
|
(setq filesets-output-buffer-flag t)
|
|
|
|
|
(set-visited-file-name file t)
|
|
|
|
|
(when oh
|
|
|
|
|
(run-hooks 'oh))
|
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
|
(setq buffer-read-only t)
|
2004-11-08 16:42:25 +00:00
|
|
|
|
(goto-char (point-min)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(when oh
|
|
|
|
|
(run-hooks 'oh))))
|
|
|
|
|
(filesets-error 'error
|
|
|
|
|
"Filesets: general error when spawning external viewer"))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-find-file (file)
|
|
|
|
|
"Call `find-file' after a possible delay (see `filesets-find-file-delay').
|
|
|
|
|
If `filesets-be-docile-flag' is true, a file, which isn't readable, will
|
|
|
|
|
not be opened."
|
|
|
|
|
; (sleep-for filesets-find-file-delay)
|
|
|
|
|
(when (or (file-readable-p file)
|
|
|
|
|
(not filesets-be-docile-flag))
|
|
|
|
|
(sit-for filesets-find-file-delay)
|
|
|
|
|
(find-file file)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-find-or-display-file (&optional file viewer)
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Visit FILE using an external VIEWER or open it in an Emacs buffer."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((file (or file
|
|
|
|
|
(read-file-name "Find file: " nil nil viewer)))
|
|
|
|
|
(external-viewer-def (or
|
|
|
|
|
(filesets-get-external-viewer-by-name viewer)
|
|
|
|
|
(filesets-get-external-viewer file))))
|
|
|
|
|
(filesets-message 3 "Filesets: view %S using %s" file external-viewer-def)
|
|
|
|
|
(if external-viewer-def
|
|
|
|
|
(filesets-spawn-external-viewer file external-viewer-def)
|
|
|
|
|
(filesets-find-file file))))
|
|
|
|
|
|
2002-04-30 01:59:00 +00:00
|
|
|
|
(defun filesets-find-file-using ()
|
2002-04-28 21:16:32 +00:00
|
|
|
|
"Select a viewer and call `filesets-find-or-display-file'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((lst (mapcar (lambda (this)
|
|
|
|
|
(let ((a (cadr this)))
|
|
|
|
|
(list (format "%s" a) a)))
|
|
|
|
|
filesets-external-viewers))
|
|
|
|
|
(viewer (completing-read "Using viewer: " lst nil t)))
|
|
|
|
|
(when viewer
|
|
|
|
|
(filesets-find-or-display-file nil (cadr (assoc viewer lst))))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-browser-name ()
|
2002-05-05 01:55:25 +00:00
|
|
|
|
"Get the directory browser's name as defined in `filesets-browse-dir-function'."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(cond
|
2002-05-05 01:55:25 +00:00
|
|
|
|
((listp filesets-browse-dir-function)
|
|
|
|
|
(car filesets-browse-dir-function))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(t
|
2002-05-05 01:55:25 +00:00
|
|
|
|
filesets-browse-dir-function)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-browse-dir (dir)
|
2002-05-05 01:55:25 +00:00
|
|
|
|
"Browse DIR using `filesets-browse-dir-function'."
|
|
|
|
|
(if (functionp filesets-browse-dir-function)
|
|
|
|
|
(funcall filesets-browse-dir-function dir)
|
|
|
|
|
(let ((name (car filesets-browse-dir-function))
|
|
|
|
|
(args (format (cadr filesets-browse-dir-function) (expand-file-name dir))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(start-process (concat "Filesets:" name)
|
|
|
|
|
"*Filesets external directory browser*"
|
|
|
|
|
name args)))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-get-fileset-name (something)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Get SOMETHING's name (Don't ask)."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(cond
|
|
|
|
|
((listp something)
|
|
|
|
|
(car something))
|
|
|
|
|
(t
|
|
|
|
|
something)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-data-get-name (entry)
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Access to `filesets-data'. Get the ENTRY's name."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(car entry))
|
|
|
|
|
|
|
|
|
|
(defun filesets-data-get-data (entry)
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Access to `filesets-data'. Get the ENTRY's data section."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(cdr entry))
|
|
|
|
|
|
|
|
|
|
(defun filesets-alist-get (alist key &optional default carp)
|
|
|
|
|
"Get KEY's value in the association list ALIST.
|
|
|
|
|
Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil."
|
2007-10-15 17:24:36 +00:00
|
|
|
|
(let ((elt (assoc key alist)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(cond
|
2007-10-15 17:24:36 +00:00
|
|
|
|
(elt
|
|
|
|
|
(if carp
|
|
|
|
|
(cadr elt)
|
|
|
|
|
(cdr elt)))
|
|
|
|
|
(default default)
|
|
|
|
|
(t nil))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-data-get (entry key &optional default carp)
|
|
|
|
|
"Extract the value for KEY in the data part of fileset ENTRY.
|
|
|
|
|
Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil."
|
|
|
|
|
(filesets-alist-get (filesets-data-get-data entry) key default carp))
|
|
|
|
|
|
|
|
|
|
(defun filesets-data-set (entry key value)
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Set the VALUE for KEY in the data part of fileset ENTRY."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let* ((alist (filesets-data-get-data entry))
|
|
|
|
|
(elt (assoc key alist)))
|
|
|
|
|
(if elt
|
|
|
|
|
(setcdr elt value)
|
|
|
|
|
(setcdr entry (cons (cons key value) alist)))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-mode (entry)
|
|
|
|
|
"Return fileset ENTRY's mode: :files, :file, :tree, :pattern, or :ingroup.
|
|
|
|
|
See `filesets-data'."
|
|
|
|
|
(let ((data (filesets-data-get-data entry)))
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(filesets-some
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(if (assoc x data)
|
|
|
|
|
x))
|
|
|
|
|
'(:files :tree :pattern :ingroup :file))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-open-fn (fileset-name &optional fileset-entry)
|
|
|
|
|
"Get the open-function for FILESET-NAME.
|
|
|
|
|
Use FILESET-ENTRY for finding the open function, if provided."
|
|
|
|
|
(filesets-data-get (or fileset-entry
|
|
|
|
|
(filesets-get-fileset-from-name fileset-name))
|
2002-05-05 01:55:25 +00:00
|
|
|
|
':open filesets-open-file-function t))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-save-fn (fileset-name &optional fileset-entry)
|
|
|
|
|
"Get the save-function for FILESET-NAME.
|
|
|
|
|
Use FILESET-ENTRY for finding the save function, if provided."
|
|
|
|
|
(filesets-data-get (or fileset-entry
|
|
|
|
|
(filesets-get-fileset-from-name fileset-name))
|
2002-05-05 01:55:25 +00:00
|
|
|
|
':save filesets-save-buffer-function t))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-files (entry)
|
|
|
|
|
"Get the file list for fileset ENTRY."
|
|
|
|
|
(filesets-data-get entry ':files))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-set-files (entry data &optional anyways)
|
|
|
|
|
"Set the file list for fileset ENTRY."
|
|
|
|
|
(let ((files (filesets-entry-get-files entry)))
|
|
|
|
|
(if (or anyways files)
|
|
|
|
|
(filesets-data-set entry ':files data))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-verbosity (entry)
|
|
|
|
|
"Get verbosity level for fileset ENTRY."
|
|
|
|
|
(filesets-data-get entry ':verbosity 1 t))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-file (entry)
|
|
|
|
|
"Get the single file for fileset ENTRY."
|
|
|
|
|
(filesets-data-get entry ':file nil t))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-pattern (entry)
|
|
|
|
|
"Get the base directory + file pattern for fileset ENTRY."
|
|
|
|
|
; (filesets-data-get entry ':pattern nil t))
|
|
|
|
|
(filesets-data-get entry ':pattern))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-pattern--pattern (list)
|
|
|
|
|
"Get the file pattern for LIST."
|
|
|
|
|
(if (= (length list) 1) ;; for compatibility with filesets < v1.5.5
|
|
|
|
|
(file-name-nondirectory (car list))
|
|
|
|
|
(cadr list)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-pattern--dir (list)
|
|
|
|
|
"Get a file pattern's base directory for LIST."
|
|
|
|
|
(if (= (length list) 1) ;; for compatibility with filesets < v1.5.5
|
|
|
|
|
(file-name-directory (car list))
|
|
|
|
|
(car list)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-tree (entry)
|
|
|
|
|
"Get the tree pattern for fileset ENTRY."
|
|
|
|
|
(filesets-data-get entry ':tree))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-dormant-flag (entry)
|
|
|
|
|
"Get dormant flag for fileset ENTRY."
|
|
|
|
|
(let ((fn (filesets-data-get entry ':dormant-p nil t)))
|
|
|
|
|
(if fn
|
|
|
|
|
(funcall fn)
|
|
|
|
|
(filesets-data-get entry ':dormant-flag nil t))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-filter-dirs-flag (entry)
|
|
|
|
|
"Get filter-dirs-flag for fileset ENTRY."
|
|
|
|
|
(filesets-data-get entry ':filter-dirs-flag nil t))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-tree-max-level (entry)
|
|
|
|
|
"Get maximal tree scanning depth for fileset ENTRY."
|
|
|
|
|
(filesets-data-get entry ':tree-max-level nil t))
|
|
|
|
|
|
|
|
|
|
(defun filesets-entry-get-master (entry)
|
|
|
|
|
"Get the base file for fileset ENTRY."
|
|
|
|
|
(filesets-data-get entry ':ingroup nil t))
|
|
|
|
|
|
|
|
|
|
(defun filesets-file-open (open-function file-name &optional fileset-name)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Open FILE-NAME using OPEN-FUNCTION.
|
|
|
|
|
If OPEN-FUNCTION is nil, its value will be deduced from FILESET-NAME."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((open-function (or open-function
|
|
|
|
|
(filesets-entry-get-open-fn fileset-name))))
|
|
|
|
|
(if (file-readable-p file-name)
|
|
|
|
|
(funcall open-function file-name)
|
|
|
|
|
(message "Filesets: Couldn't open `%s'" file-name))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-file-close (save-function buffer)
|
|
|
|
|
"Close BUFFER.
|
|
|
|
|
First, save the buffer's contents using SAVE-FUNCTION. Then, kill buffer
|
|
|
|
|
if `buffer-modified-p' returns nil.
|
|
|
|
|
|
|
|
|
|
SAVE-FUNCTION takes no argument, but works on the current buffer."
|
* x-dnd.el (x-dnd-maybe-call-test-function):
* window.el (split-window-vertically):
* whitespace.el (whitespace-help-on):
* vc-rcs.el (vc-rcs-consult-headers):
* userlock.el (ask-user-about-lock-help)
(ask-user-about-supersession-help):
* type-break.el (type-break-force-mode-line-update):
* time-stamp.el (time-stamp-conv-warn):
* terminal.el (te-set-output-log, te-more-break, te-filter)
(te-sentinel,terminal-emulator):
* term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
(term-write-input-ring, term-check-source, term-start-output-log):
(term-display-buffer-line, term-dynamic-list-completions):
(term-ansi-make-term, serial-term):
* subr.el (selective-display):
* strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
(strokes-encode-buffer, strokes-xpm-for-compressed-string):
* speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
(speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
(speedbar-remove-localized-speedbar-support)
(speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
(speedbar-update-special-contents, speedbar-buffer-buttons-engine)
(speedbar-buffers-line-directory):
* simple.el (shell-command-on-region, append-to-buffer)
(prepend-to-buffer):
* shadowfile.el (shadow-save-todo-file):
* scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
(scroll-bar-maybe-set-window-start):
* sb-image.el (speedbar-image-dump):
* saveplace.el (save-place-alist-to-file, save-places-to-alist)
(load-save-place-alist-from-file):
* ps-samp.el (ps-print-message-from-summary):
* ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
(ps-background-image, ps-begin-job, ps-do-despool):
* ps-bdf.el (bdf-find-file, bdf-read-font-info):
* printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
(pr-ps-message-from-summary, pr-lpr-message-from-summary):
(pr-call-process, pr-file-list, pr-interface-save):
* novice.el (disabled-command-function)
(enable-command, disable-command):
* mouse.el (mouse-buffer-menu-alist):
* mouse-copy.el (mouse-kill-preserving-secondary):
* macros.el (kbd-macro-query):
* ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
* informat.el (batch-info-validate):
* ido.el (ido-copy-current-word, ido-initiate-auto-merge):
* hippie-exp.el (try-expand-dabbrev-visible):
* help-mode.el (help-make-xrefs):
* help-fns.el (describe-variable):
* generic-x.el (bat-generic-mode-run-as-comint):
* finder.el (finder-mouse-select):
* find-dired.el (find-dired-sentinel):
* filesets.el (filesets-file-close):
* files.el (list-directory):
* faces.el (list-faces-display, describe-face):
* facemenu.el (list-colors-display):
* ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
* epg.el (epg--process-filter, epg-cancel):
* epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
(epa--read-signature-type):
* emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
(emerge-file-names):
* ehelp.el (electric-helpify):
* ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
* ediff-vers.el (rcs-ediff-view-revision):
* ediff-util.el (ediff-setup):
* ediff-mult.el (ediff-append-custom-diff):
* ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
(ediff-wordify):
* echistory.el (Electric-command-history-redo-expression):
* dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
* disp-table.el (describe-display-table):
* dired.el (dired-find-buffer-nocreate):
* dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
* dabbrev.el (dabbrev--same-major-mode-p):
* chistory.el (list-command-history):
* apropos.el (apropos-documentation):
* allout.el (allout-obtain-passphrase):
(allout-copy-exposed-to-buffer):
(allout-verify-passphrase): Use with-current-buffer.
2009-11-13 22:19:45 +00:00
|
|
|
|
(with-current-buffer buffer
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(if (buffer-modified-p)
|
|
|
|
|
(funcall save-function))
|
|
|
|
|
(if (not (buffer-modified-p))
|
|
|
|
|
(kill-buffer buffer))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-get-fileset-from-name (name &optional mode)
|
|
|
|
|
"Get fileset definition for NAME."
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(pcase mode
|
|
|
|
|
((or `:ingroup `:tree) name)
|
|
|
|
|
(_ (assoc name filesets-data))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; commands
|
|
|
|
|
(defun filesets-cmd-get-def (cmd-name)
|
|
|
|
|
"Get `filesets-commands' entry for CMD-NAME."
|
|
|
|
|
(assoc cmd-name filesets-commands))
|
|
|
|
|
|
|
|
|
|
(defun filesets-cmd-get-args (cmd-name)
|
|
|
|
|
(let ((args (let ((def (filesets-cmd-get-def cmd-name)))
|
|
|
|
|
(nth 2 def)))
|
|
|
|
|
(rv nil))
|
|
|
|
|
(dolist (this args rv)
|
|
|
|
|
(cond
|
|
|
|
|
((and (symbolp this) (fboundp this))
|
|
|
|
|
(let ((x (funcall this)))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(setq rv (append rv (if (listp x) x (list x))))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(t
|
|
|
|
|
(setq rv (append rv (list this))))))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-cmd-get-fn (cmd-name)
|
|
|
|
|
(let ((def (filesets-cmd-get-def cmd-name)))
|
|
|
|
|
(nth 1 def)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-cmd-show-result (cmd output)
|
|
|
|
|
"Show OUTPUT of CMD (a shell command)."
|
|
|
|
|
(pop-to-buffer "*Filesets: Shell Command Output*")
|
2004-11-08 16:42:25 +00:00
|
|
|
|
(with-no-warnings
|
|
|
|
|
(end-of-buffer))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(insert "*** ")
|
|
|
|
|
(insert cmd)
|
|
|
|
|
(newline)
|
|
|
|
|
(insert output)
|
|
|
|
|
(newline))
|
|
|
|
|
|
|
|
|
|
(defun filesets-run-cmd--repl-fn (arg &optional format-fn)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Helper function for `filesets-run-cmd'. Apply FORMAT-FN to arg.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
Replace <file-name> or <<file-name>> with filename."
|
|
|
|
|
(funcall format-fn (cond
|
|
|
|
|
((equal arg "<file-name>")
|
|
|
|
|
(buffer-file-name))
|
|
|
|
|
((equal arg "<<file-name>>")
|
2006-10-14 23:25:55 +00:00
|
|
|
|
(shell-quote-argument (buffer-file-name)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(t
|
|
|
|
|
arg))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-run-cmd (&optional cmd-name fileset mode)
|
|
|
|
|
"Run CMD-NAME (see `filesets-commands') on FILESET."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((cmd-name (or cmd-name
|
|
|
|
|
(completing-read "Select command: " filesets-commands
|
|
|
|
|
nil t)))
|
|
|
|
|
(name (or fileset
|
|
|
|
|
(completing-read "Select fileset: " filesets-data nil t))))
|
|
|
|
|
(when (and cmd-name name)
|
|
|
|
|
(let* ((event (if (equal cmd-name "Grep <<selection>>")
|
|
|
|
|
'on-grep
|
|
|
|
|
'on-cmd))
|
|
|
|
|
(files (if (and fileset
|
|
|
|
|
(or (equal mode ':ingroup)
|
|
|
|
|
(equal mode ':tree)))
|
|
|
|
|
(filesets-get-filelist fileset mode event)
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(filesets-get-filelist
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(filesets-get-fileset-from-name name)
|
|
|
|
|
mode event))))
|
|
|
|
|
(when files
|
|
|
|
|
(let ((fn (filesets-cmd-get-fn cmd-name))
|
|
|
|
|
(args (filesets-cmd-get-args cmd-name)))
|
2008-07-24 00:09:01 +00:00
|
|
|
|
(if (memq fn '(multi-isearch-files multi-isearch-files-regexp))
|
|
|
|
|
(apply fn args)
|
|
|
|
|
(dolist (this files nil)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(let ((buffer (filesets-find-file this)))
|
|
|
|
|
(when buffer
|
|
|
|
|
(goto-char (point-min))
|
2009-09-13 02:14:25 +00:00
|
|
|
|
(progn
|
2008-07-24 00:09:01 +00:00
|
|
|
|
(cond
|
|
|
|
|
((stringp fn)
|
|
|
|
|
(let* ((args
|
|
|
|
|
(let ((txt ""))
|
|
|
|
|
(dolist (this args txt)
|
|
|
|
|
(setq txt
|
|
|
|
|
(concat txt
|
|
|
|
|
(filesets-run-cmd--repl-fn
|
|
|
|
|
this
|
|
|
|
|
(lambda (this)
|
|
|
|
|
(if (equal txt "") "" " ")
|
|
|
|
|
(format "%s" this))))))))
|
|
|
|
|
(cmd (concat fn " " args)))
|
|
|
|
|
(filesets-cmd-show-result
|
|
|
|
|
cmd (shell-command-to-string cmd))))
|
|
|
|
|
((symbolp fn)
|
|
|
|
|
(let ((args
|
|
|
|
|
(let ((argl nil))
|
|
|
|
|
(dolist (this args argl)
|
|
|
|
|
(setq argl
|
|
|
|
|
(append argl
|
|
|
|
|
(filesets-run-cmd--repl-fn
|
|
|
|
|
this
|
|
|
|
|
'list)))))))
|
|
|
|
|
(apply fn args)))))))))))))))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-get-cmd-menu ()
|
|
|
|
|
"Create filesets command menu."
|
|
|
|
|
`("+ Commands"
|
|
|
|
|
. ,(mapcar (lambda (this)
|
|
|
|
|
(let ((name (car this)))
|
|
|
|
|
`[,name (filesets-run-cmd ,name)]))
|
|
|
|
|
filesets-commands)))
|
|
|
|
|
|
|
|
|
|
|
2007-10-15 17:24:36 +00:00
|
|
|
|
;;; sample commands
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(defun filesets-cmd-query-replace-getargs ()
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Get arguments for `query-replace' and `query-replace-regexp'."
|
2008-07-24 00:09:01 +00:00
|
|
|
|
(let ((common (query-replace-read-args "Filesets query replace" nil t)))
|
|
|
|
|
(list (nth 0 common) (nth 1 common) t nil (nth 2 common) nil
|
|
|
|
|
multi-query-replace-map)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-cmd-query-replace-regexp-getargs ()
|
|
|
|
|
"Get arguments for `query-replace' and `query-replace-regexp'."
|
|
|
|
|
(let ((common (query-replace-read-args "Filesets query replace" t t)))
|
|
|
|
|
(list (nth 0 common) (nth 1 common) t t (nth 2 common) nil
|
|
|
|
|
multi-query-replace-map)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-cmd-isearch-getargs ()
|
|
|
|
|
"Get arguments for `multi-isearch-files' and `multi-isearch-files-regexp'."
|
2008-07-31 17:18:33 +00:00
|
|
|
|
(and (boundp 'files) (list files)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-cmd-shell-command-getargs ()
|
|
|
|
|
"Get arguments for `filesets-cmd-shell-command'."
|
|
|
|
|
(let* ((arg (read-string "Shell command (%s = file): "
|
|
|
|
|
"%s"
|
|
|
|
|
'shell-command-history)))
|
|
|
|
|
arg))
|
|
|
|
|
|
|
|
|
|
(defun filesets-cmd-shell-command (txt)
|
|
|
|
|
"Wrapper function for `shell-command'."
|
|
|
|
|
(let ((ok (if (buffer-modified-p)
|
|
|
|
|
(let ((ok (y-or-n-p "Save buffer? ")))
|
|
|
|
|
(when ok
|
|
|
|
|
(save-buffer))
|
|
|
|
|
ok)
|
|
|
|
|
t)))
|
|
|
|
|
(when ok
|
2006-10-14 14:10:25 +00:00
|
|
|
|
(let ((cmd (format txt (shell-quote-argument (buffer-file-name)))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(message "Filesets: %s" cmd)
|
|
|
|
|
(filesets-cmd-show-result cmd
|
|
|
|
|
(shell-command-to-string cmd))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; body
|
|
|
|
|
(defun filesets-get-filelist (entry &optional mode event)
|
|
|
|
|
"Get all files for fileset ENTRY.
|
|
|
|
|
Assume MODE (see `filesets-entry-mode'), if provided."
|
|
|
|
|
(let* ((mode (or mode
|
|
|
|
|
(filesets-entry-mode entry)))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(fl (pcase mode
|
|
|
|
|
(:files
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(filesets-entry-get-files entry))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:file
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(list (filesets-entry-get-file entry)))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:ingroup
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((entry (expand-file-name
|
|
|
|
|
(if (stringp entry)
|
|
|
|
|
entry
|
|
|
|
|
(filesets-entry-get-master entry)))))
|
|
|
|
|
(cons entry (filesets-ingroup-cache-get entry))))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:tree
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((dir (nth 0 entry))
|
|
|
|
|
(patt (nth 1 entry)))
|
|
|
|
|
(filesets-directory-files dir patt ':files t)))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:pattern
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((dirpatt (filesets-entry-get-pattern entry)))
|
|
|
|
|
(if dirpatt
|
|
|
|
|
(let ((dir (filesets-entry-get-pattern--dir dirpatt))
|
|
|
|
|
(patt (filesets-entry-get-pattern--pattern dirpatt)))
|
|
|
|
|
;;(filesets-message 3 "Filesets: scanning %s" dirpatt)
|
|
|
|
|
(filesets-directory-files dir patt ':files t))
|
|
|
|
|
;; (message "Filesets: malformed entry: %s" entry)))))))
|
|
|
|
|
(filesets-error 'error "Filesets: malformed entry: "
|
|
|
|
|
entry)))))))
|
|
|
|
|
(filesets-filter-list fl
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(not (filesets-filetype-property file event))))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-open (&optional mode name lookup-name)
|
|
|
|
|
"Open the fileset called NAME.
|
|
|
|
|
Use LOOKUP-NAME for searching additional data if provided."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((name (or name
|
|
|
|
|
(completing-read "Open fileset: " filesets-data nil t)))
|
|
|
|
|
(fileset (filesets-get-fileset-from-name name mode))
|
|
|
|
|
(lookup-fs (if lookup-name
|
|
|
|
|
(filesets-get-fileset-from-name lookup-name)
|
|
|
|
|
fileset))
|
|
|
|
|
(mode (or mode (filesets-entry-mode lookup-fs))))
|
|
|
|
|
(if fileset
|
|
|
|
|
(let* ((files (filesets-get-filelist fileset mode 'on-open-all))
|
|
|
|
|
(n (length files))
|
|
|
|
|
(open-function (filesets-entry-get-open-fn nil lookup-fs)))
|
|
|
|
|
(if (or (<= n filesets-query-user-limit)
|
|
|
|
|
(y-or-n-p (format "Filesets: Open all %d files in %s? "
|
|
|
|
|
n name)))
|
|
|
|
|
(dolist (this files nil)
|
|
|
|
|
(filesets-file-open open-function this))
|
|
|
|
|
(message "Filesets: cancelled")))
|
|
|
|
|
(filesets-error 'error "Filesets: Unknown fileset: " name))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-close (&optional mode name lookup-name)
|
|
|
|
|
"Close all buffers belonging to the fileset called NAME.
|
|
|
|
|
Use LOOKUP-NAME for deducing the save-function, if provided."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((name (or name
|
|
|
|
|
(completing-read "Close fileset: " filesets-data nil t)))
|
|
|
|
|
(fileset (filesets-get-fileset-from-name name mode))
|
|
|
|
|
(lookup-fs (if lookup-name
|
|
|
|
|
(filesets-get-fileset-from-name lookup-name)
|
|
|
|
|
fileset))
|
|
|
|
|
(mode (or mode (filesets-entry-mode lookup-fs))))
|
|
|
|
|
(if fileset
|
|
|
|
|
(let ((files (filesets-get-filelist fileset mode 'on-close-all))
|
|
|
|
|
(save-function (filesets-entry-get-save-fn nil lookup-fs)))
|
|
|
|
|
(dolist (file-name files nil)
|
|
|
|
|
(let* ((buffer (get-file-buffer file-name)))
|
|
|
|
|
(if buffer
|
|
|
|
|
(filesets-file-close save-function buffer)))))
|
|
|
|
|
; (message "Filesets: Unknown fileset: `%s'" name))))
|
|
|
|
|
(filesets-error 'error "Filesets: Unknown fileset: " name))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-add-buffer (&optional name buffer)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Add BUFFER (or current buffer) to the fileset called NAME.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
User will be queried, if no fileset name is provided."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((buffer (or buffer
|
|
|
|
|
(current-buffer)))
|
|
|
|
|
(name (or name
|
|
|
|
|
(completing-read
|
|
|
|
|
(format "Add '%s' to fileset: " buffer)
|
2005-04-16 15:22:12 +00:00
|
|
|
|
filesets-data nil)))
|
|
|
|
|
(entry (or (assoc name filesets-data)
|
|
|
|
|
(when (y-or-n-p
|
2006-08-13 17:05:12 +00:00
|
|
|
|
(format "Fileset %s does not exist. Create it? "
|
2005-04-16 15:22:12 +00:00
|
|
|
|
name))
|
|
|
|
|
(progn
|
|
|
|
|
(add-to-list 'filesets-data (list name '(:files)))
|
|
|
|
|
(message
|
|
|
|
|
"Fileset %s created. Call `M-x filesets-save-config' to save."
|
|
|
|
|
name)
|
|
|
|
|
(car filesets-data))))))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(if entry
|
|
|
|
|
(let* ((files (filesets-entry-get-files entry))
|
|
|
|
|
(this (buffer-file-name buffer))
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(inlist (filesets-member this files
|
|
|
|
|
:test 'filesets-files-equalp)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(cond
|
|
|
|
|
(inlist
|
|
|
|
|
(message "Filesets: '%s' is already in '%s'" this name))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
((and (equal (filesets-entry-mode entry) ':files)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
this)
|
|
|
|
|
(filesets-entry-set-files entry (cons this files) t)
|
|
|
|
|
(filesets-set-config name 'filesets-data filesets-data))
|
|
|
|
|
(t
|
|
|
|
|
(message "Filesets: Can't add '%s' to fileset '%s'" this name)))))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-remove-buffer (&optional name buffer)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Remove BUFFER (or current buffer) to fileset NAME.
|
2002-04-28 21:16:32 +00:00
|
|
|
|
User will be queried, if no fileset name is provided."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((buffer (or buffer
|
|
|
|
|
(current-buffer)))
|
|
|
|
|
(name (or name
|
|
|
|
|
(completing-read
|
|
|
|
|
(format "Remove '%s' from fileset: " buffer)
|
|
|
|
|
filesets-data nil t)))
|
|
|
|
|
(entry (assoc name filesets-data)))
|
|
|
|
|
(if entry
|
|
|
|
|
(let* ((files (filesets-entry-get-files entry))
|
|
|
|
|
(this (buffer-file-name buffer))
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(inlist (filesets-member this files
|
|
|
|
|
:test 'filesets-files-equalp)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
;;(message "%s %s %s" files this inlist)
|
|
|
|
|
(if (and files this inlist)
|
|
|
|
|
(let ((new (list (cons ':files (delete (car inlist) files)))))
|
|
|
|
|
(setcdr entry new)
|
|
|
|
|
(filesets-set-config name 'filesets-data filesets-data))
|
|
|
|
|
(message "Filesets: Can't remove '%s' from fileset '%s'"
|
|
|
|
|
this
|
|
|
|
|
name))))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-convert-patterns (name)
|
|
|
|
|
"Change fileset NAME's mode from :pattern to :files."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((entry (assoc name filesets-data)))
|
|
|
|
|
(if entry
|
|
|
|
|
(let ((pattern (filesets-entry-get-pattern entry))
|
|
|
|
|
(patfiles (filesets-get-filelist entry ':pattern)))
|
|
|
|
|
(if pattern
|
|
|
|
|
(progn
|
|
|
|
|
(filesets-entry-set-files entry patfiles t)
|
|
|
|
|
(filesets-set-config name 'filesets-data filesets-data)))))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-edit ()
|
|
|
|
|
"Customize `filesets-data'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(customize-variable 'filesets-data))
|
|
|
|
|
|
|
|
|
|
(defun filesets-customize ()
|
|
|
|
|
"Customize the filesets group."
|
|
|
|
|
(interactive)
|
|
|
|
|
(customize-group 'filesets))
|
|
|
|
|
|
|
|
|
|
(defun filesets-info ()
|
|
|
|
|
"Display filesets's version information."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (y-or-n-p (format "Filesets v%s: visit homepage? " filesets-version))
|
|
|
|
|
(filesets-goto-homepage)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-goto-homepage ()
|
|
|
|
|
"Show filesets's homepage."
|
|
|
|
|
(interactive)
|
|
|
|
|
(browse-url filesets-homepage))
|
|
|
|
|
|
|
|
|
|
(defun filesets-remake-shortcut (count submenu)
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Remake a submenu's shortcut when wrapping long menus."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let* ((name (concat (filesets-get-shortcut count)
|
|
|
|
|
(substring (elt submenu 0) 2))))
|
|
|
|
|
(if (listp submenu)
|
|
|
|
|
(cons name (cdr submenu))
|
|
|
|
|
(apply 'vector (list name (cdr (append submenu nil)))))))
|
|
|
|
|
; (vconcat `[,name] (subseq submenu 1)))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-wrap-submenu (submenu-body)
|
|
|
|
|
"Split long submenus."
|
|
|
|
|
(let ((bl (length submenu-body)))
|
|
|
|
|
(if (or (= filesets-max-submenu-length 0)
|
|
|
|
|
(<= bl filesets-max-submenu-length))
|
|
|
|
|
submenu-body
|
|
|
|
|
(let* ((result nil)
|
|
|
|
|
(factor (ceiling (/ (float bl)
|
|
|
|
|
filesets-max-submenu-length))))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(cl-do ((data submenu-body (cdr data))
|
|
|
|
|
(n 1 (+ n 1))
|
|
|
|
|
(count 0 (+ count factor)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
((or (> count bl)
|
|
|
|
|
(null data)))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
;; (let ((sl (subseq submenu-body count
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((sl (filesets-sublist submenu-body count
|
|
|
|
|
(let ((x (+ count factor)))
|
|
|
|
|
(if (>= bl x)
|
|
|
|
|
x
|
|
|
|
|
nil)))))
|
|
|
|
|
(when sl
|
|
|
|
|
(setq result
|
|
|
|
|
(append
|
|
|
|
|
result
|
|
|
|
|
(if (= (length sl) 1)
|
|
|
|
|
(if filesets-menu-shortcuts-flag
|
|
|
|
|
(list (filesets-remake-shortcut n (car sl)))
|
|
|
|
|
sl)
|
|
|
|
|
`((,(concat
|
|
|
|
|
(filesets-get-shortcut n)
|
|
|
|
|
(let ((rv ""))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(cl-do ((x sl (cdr x)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
((null x))
|
|
|
|
|
(let ((y (concat (elt (car x) 0)
|
|
|
|
|
(if (null (cdr x))
|
|
|
|
|
""
|
|
|
|
|
", "))))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(setq rv
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(concat
|
|
|
|
|
rv
|
|
|
|
|
(if filesets-menu-shortcuts-flag
|
|
|
|
|
(substring y 2)
|
|
|
|
|
y)))))
|
|
|
|
|
(if (> (length rv)
|
|
|
|
|
filesets-max-entry-length)
|
|
|
|
|
(concat
|
|
|
|
|
(substring rv 0 filesets-max-entry-length)
|
|
|
|
|
" ...")
|
|
|
|
|
rv)))
|
|
|
|
|
,@sl))))))))
|
|
|
|
|
result))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-get-menu-epilog (something &optional
|
|
|
|
|
mode lookup-name rebuild-flag)
|
|
|
|
|
"Get submenu epilog for SOMETHING (usually a fileset).
|
|
|
|
|
If mode is :tree or :ingroup, SOMETHING is some weird construct and
|
|
|
|
|
LOOKUP-NAME is used as lookup name for retrieving fileset specific settings."
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(pcase mode
|
|
|
|
|
(:tree
|
2002-04-28 21:16:32 +00:00
|
|
|
|
`("---"
|
|
|
|
|
["Close all files" (filesets-close ',mode ',something ',lookup-name)]
|
|
|
|
|
["Run Command" (filesets-run-cmd nil ',something ',mode)]
|
|
|
|
|
[,(format "Browse with `%s'" (filesets-browser-name))
|
|
|
|
|
(filesets-browse-dir ',(car something))]
|
|
|
|
|
,@(when rebuild-flag
|
|
|
|
|
`(["Rebuild this submenu"
|
|
|
|
|
(filesets-rebuild-this-submenu ',lookup-name)]))))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:ingroup
|
2002-04-28 21:16:32 +00:00
|
|
|
|
`("---"
|
|
|
|
|
["Close all files" (filesets-close ',mode ',something ',lookup-name)]
|
|
|
|
|
["Run Command" (filesets-run-cmd nil ',something ',mode)]
|
|
|
|
|
,@(when rebuild-flag
|
|
|
|
|
`(["Rebuild this submenu"
|
|
|
|
|
(filesets-rebuild-this-submenu ',lookup-name)]))))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:pattern
|
2002-04-28 21:16:32 +00:00
|
|
|
|
`("---"
|
|
|
|
|
["Close all files" (filesets-close ',mode ',something)]
|
|
|
|
|
["Run Command" (filesets-run-cmd nil ',something ',mode)]
|
|
|
|
|
[,(format "Browse with `%s'" (filesets-browser-name))
|
|
|
|
|
,(list 'filesets-browse-dir
|
|
|
|
|
(filesets-entry-get-pattern--dir
|
|
|
|
|
(filesets-entry-get-pattern
|
|
|
|
|
(filesets-get-fileset-from-name something ':pattern))))]
|
|
|
|
|
; [,(concat (if filesets-menu-shortcuts-flag
|
|
|
|
|
; (concat "Con" filesets-menu-shortcuts-marker "vert")
|
|
|
|
|
; "Convert")
|
|
|
|
|
; " :pattern to :files")
|
|
|
|
|
; ,(list (function filesets-convert-patterns) something)]
|
|
|
|
|
,@(when rebuild-flag
|
|
|
|
|
`(["Rebuild this submenu"
|
|
|
|
|
(filesets-rebuild-this-submenu ',lookup-name)]))))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:files
|
2002-04-28 21:16:32 +00:00
|
|
|
|
`("---"
|
|
|
|
|
[,(concat "Close all files") (filesets-close ',mode ',something)]
|
|
|
|
|
["Run Command" (filesets-run-cmd nil ',something ',mode)]
|
|
|
|
|
["Add current buffer"
|
|
|
|
|
(filesets-add-buffer ',something (current-buffer))]
|
|
|
|
|
["Remove current buffer"
|
|
|
|
|
(filesets-remove-buffer ',something (current-buffer))]
|
|
|
|
|
,@(when rebuild-flag
|
|
|
|
|
`(["Rebuild this submenu"
|
|
|
|
|
(filesets-rebuild-this-submenu ',lookup-name)]))))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(_
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(filesets-error 'error "Filesets: malformed definition of " something))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-ingroup-get-data (master pos &optional fun)
|
|
|
|
|
"Access to `filesets-ingroup-patterns'. Extract data section."
|
|
|
|
|
(let ((masterfile (file-name-nondirectory master))
|
|
|
|
|
(fn (or fun (lambda (a b)
|
|
|
|
|
(and (stringp a)
|
|
|
|
|
(stringp b)
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(string-match-p a b))))))
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(filesets-some (lambda (x)
|
|
|
|
|
(if (funcall fn (car x) masterfile)
|
|
|
|
|
(nth pos x)
|
|
|
|
|
nil))
|
|
|
|
|
filesets-ingroup-patterns)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
(defun filesets-ingroup-get-pattern (master)
|
|
|
|
|
"Access to `filesets-ingroup-patterns'. Extract patterns."
|
|
|
|
|
(filesets-ingroup-get-data master 2))
|
|
|
|
|
|
|
|
|
|
(defun filesets-ingroup-get-remdupl-p (master)
|
|
|
|
|
"Access to `filesets-ingroup-patterns'. Extract remove-duplicates-flag."
|
|
|
|
|
(filesets-ingroup-get-data master 1))
|
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(defun filesets-ingroup-collect-finder (patt case-sensitivep)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
"Helper function for `filesets-ingroup-collect'. Find pattern PATT."
|
|
|
|
|
(let ((cfs case-fold-search)
|
|
|
|
|
(rv (progn
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(setq case-fold-search (not case-sensitivep))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(re-search-forward patt nil t))))
|
|
|
|
|
(setq case-fold-search cfs)
|
|
|
|
|
rv))
|
|
|
|
|
|
|
|
|
|
(defun filesets-ingroup-cache-get (master)
|
|
|
|
|
"Access to `filesets-ingroup-cache'."
|
|
|
|
|
(lax-plist-get filesets-ingroup-cache master))
|
|
|
|
|
|
|
|
|
|
(defun filesets-ingroup-cache-put (master file)
|
|
|
|
|
"Access to `filesets-ingroup-cache'."
|
|
|
|
|
(let* ((emaster (expand-file-name master))
|
|
|
|
|
(this (if file
|
|
|
|
|
(cons file (filesets-ingroup-cache-get emaster))
|
|
|
|
|
nil)))
|
|
|
|
|
(setq filesets-ingroup-cache
|
|
|
|
|
(lax-plist-put filesets-ingroup-cache emaster this))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-ingroup-collect-files (fs &optional remdupl-flag master depth)
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Helper function for `filesets-ingroup-collect'. Collect file names."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let* ((master (or master
|
|
|
|
|
(filesets-entry-get-master fs)))
|
|
|
|
|
(remdupl-flag (or remdupl-flag
|
|
|
|
|
(filesets-ingroup-get-remdupl-p master))))
|
|
|
|
|
(filesets-ingroup-cache-put master nil)
|
|
|
|
|
(filesets-message 2 "Filesets: parsing %S" master)
|
|
|
|
|
(let ((cmdpatts (filesets-ingroup-get-pattern master))
|
|
|
|
|
(count 0)
|
|
|
|
|
(rv nil))
|
|
|
|
|
(if cmdpatts
|
|
|
|
|
(dolist (this-def cmdpatts rv)
|
|
|
|
|
(let* ((this-patt (filesets-alist-get this-def ':pattern nil t))
|
|
|
|
|
(this-name (filesets-alist-get this-def ':name "" t))
|
|
|
|
|
(this-pp (filesets-alist-get this-def ':preprocess nil t))
|
|
|
|
|
(this-mn (filesets-alist-get this-def ':match-number 1 t))
|
|
|
|
|
(this-sd (or depth
|
|
|
|
|
(filesets-alist-get this-def ':scan-depth 0 t)))
|
|
|
|
|
(this-csp (filesets-alist-get this-def ':case-sensitive nil t))
|
|
|
|
|
(this-fn (filesets-alist-get
|
|
|
|
|
this-def ':get-file-name 'filesets-which-file t))
|
|
|
|
|
(this-stubp (filesets-alist-get this-def ':stubp nil t))
|
|
|
|
|
(this-stub-flag (filesets-alist-get this-def ':stub-flag nil t))
|
|
|
|
|
(flist nil)
|
|
|
|
|
(lst nil))
|
|
|
|
|
(cond
|
|
|
|
|
((not this-patt)
|
|
|
|
|
(filesets-error 'error "Filesets: malformed :ingroup definition "
|
|
|
|
|
this-def))
|
2002-05-05 01:44:04 +00:00
|
|
|
|
((< this-sd 0)
|
|
|
|
|
nil)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(t
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-file-contents master)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(when this-pp
|
|
|
|
|
(funcall this-pp))
|
|
|
|
|
(while (filesets-ingroup-collect-finder this-patt this-csp)
|
|
|
|
|
(let* ((txt (match-string this-mn))
|
|
|
|
|
(f (funcall this-fn master txt)))
|
|
|
|
|
(when (and f
|
|
|
|
|
(not (member f flist))
|
|
|
|
|
(or (not remdupl-flag)
|
2002-05-07 16:11:30 +00:00
|
|
|
|
(not (filesets-member
|
2002-04-30 01:59:00 +00:00
|
|
|
|
f filesets-ingroup-files
|
2002-04-28 21:16:32 +00:00
|
|
|
|
:test 'filesets-files-equalp))))
|
|
|
|
|
(let ((no-stub-flag
|
|
|
|
|
(and (not this-stub-flag)
|
|
|
|
|
(if this-stubp
|
|
|
|
|
(not (funcall this-stubp master f))
|
|
|
|
|
t))))
|
|
|
|
|
(setq count (+ count 1))
|
|
|
|
|
(setq flist (cons f flist))
|
2002-04-30 01:59:00 +00:00
|
|
|
|
(setq filesets-ingroup-files
|
|
|
|
|
(cons f filesets-ingroup-files))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(when no-stub-flag
|
|
|
|
|
(filesets-ingroup-cache-put master f))
|
|
|
|
|
(setq lst (append lst (list f))))))))
|
|
|
|
|
(when lst
|
|
|
|
|
(setq rv
|
|
|
|
|
(nconc rv
|
|
|
|
|
(mapcar (lambda (this)
|
|
|
|
|
`((,this ,this-name)
|
|
|
|
|
,@(filesets-ingroup-collect-files
|
|
|
|
|
fs remdupl-flag this
|
|
|
|
|
(- this-sd 1))))
|
|
|
|
|
lst))))))))
|
|
|
|
|
(filesets-message 2 "Filesets: no patterns defined for %S" master)))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-ingroup-collect-build-menu (fs flist &optional other-count)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"Helper function for `filesets-ingroup-collect'. Build the menu.
|
|
|
|
|
FS is a fileset's name. FLIST is a list returned by
|
2002-04-28 21:16:32 +00:00
|
|
|
|
`filesets-ingroup-collect-files'."
|
|
|
|
|
(if (null flist)
|
|
|
|
|
nil
|
|
|
|
|
(let ((count 0)
|
|
|
|
|
(fsn fs)
|
|
|
|
|
(rv nil))
|
|
|
|
|
(dolist (this flist rv)
|
|
|
|
|
(setq count (+ count 1))
|
|
|
|
|
(let* ((def (if (listp this) (car this) (list this "")))
|
|
|
|
|
(files (if (listp this) (cdr this) nil))
|
|
|
|
|
(master (nth 0 def))
|
|
|
|
|
(name (nth 1 def))
|
|
|
|
|
(nm (concat (filesets-get-shortcut (if (or (not other-count) files)
|
|
|
|
|
count other-count))
|
|
|
|
|
(if (or (null name) (equal name ""))
|
|
|
|
|
""
|
|
|
|
|
(format "%s: " name))
|
|
|
|
|
(file-name-nondirectory master))))
|
|
|
|
|
(setq rv
|
|
|
|
|
(append rv
|
|
|
|
|
(if files
|
|
|
|
|
`((,nm
|
2003-01-27 08:44:27 +00:00
|
|
|
|
[,(concat "Inclusion Group: "
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(file-name-nondirectory master))
|
|
|
|
|
(filesets-open ':ingroup ',master ',fsn)]
|
|
|
|
|
"---"
|
|
|
|
|
[,master (filesets-file-open nil ',master ',fsn)]
|
|
|
|
|
"---"
|
|
|
|
|
,@(let ((count 0))
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (this)
|
|
|
|
|
(setq count (+ count 1))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(let ((ff (filesets-ingroup-collect-build-menu
|
2002-04-28 21:16:32 +00:00
|
|
|
|
fs (list this) count)))
|
|
|
|
|
(if (= (length ff) 1)
|
|
|
|
|
(car ff)
|
|
|
|
|
ff)))
|
|
|
|
|
files))
|
|
|
|
|
,@(filesets-get-menu-epilog master ':ingroup fsn)))
|
|
|
|
|
`([,nm (filesets-file-open nil ',master ',fsn)])))))))))
|
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(defun filesets-ingroup-collect (fs remdupl-flag master)
|
2007-10-15 17:24:36 +00:00
|
|
|
|
"Collect names of included files and build submenu."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(filesets-ingroup-cache-put master nil)
|
|
|
|
|
(filesets-message 2 "Filesets: parsing %S" master)
|
|
|
|
|
(filesets-ingroup-collect-build-menu
|
|
|
|
|
fs
|
|
|
|
|
(filesets-ingroup-collect-files fs remdupl-flag master)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-build-ingroup-submenu (lookup-name master)
|
|
|
|
|
"Build a :ingroup submenu for file MASTER."
|
|
|
|
|
(if (file-readable-p master)
|
|
|
|
|
(let ((remdupl-flag (filesets-ingroup-get-remdupl-p master)))
|
2002-04-30 01:59:00 +00:00
|
|
|
|
(setq filesets-ingroup-files (list master))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(filesets-ingroup-collect lookup-name remdupl-flag master))
|
|
|
|
|
(if filesets-be-docile-flag
|
|
|
|
|
(progn
|
|
|
|
|
(message "Filesets: can't parse %s" master)
|
|
|
|
|
nil)
|
|
|
|
|
(filesets-error 'error "Filesets: can't parse " master))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-build-dir-submenu-now (level depth entry lookup-name dir patt fd
|
|
|
|
|
&optional rebuild-flag)
|
|
|
|
|
"Helper function for `filesets-build-dir-submenu'."
|
|
|
|
|
;;(filesets-message 3 "Filesets: scanning %s" dir)
|
|
|
|
|
(if (or (= depth 0)
|
|
|
|
|
(< level depth))
|
|
|
|
|
(let* ((dir (file-name-as-directory dir))
|
|
|
|
|
(header `([,(concat "Tree: "
|
|
|
|
|
(if (= level 0)
|
|
|
|
|
dir
|
|
|
|
|
(concat ".../"
|
|
|
|
|
(file-name-as-directory
|
|
|
|
|
(file-name-nondirectory
|
|
|
|
|
(directory-file-name dir))))))
|
|
|
|
|
,(list (function filesets-open)
|
|
|
|
|
':tree
|
|
|
|
|
`(quote (,dir ,patt))
|
|
|
|
|
lookup-name)]
|
|
|
|
|
"---"))
|
|
|
|
|
(dirlist (filesets-directory-files dir patt nil nil fd))
|
|
|
|
|
(subdirs (filesets-filter-dir-names dirlist))
|
|
|
|
|
(count 0)
|
|
|
|
|
(dirsmenu (mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(setq count (+ count 1))
|
|
|
|
|
(let* ((x (file-name-as-directory x))
|
|
|
|
|
(xx (concat dir x))
|
|
|
|
|
(dd (filesets-build-dir-submenu-now
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(+ level 1) depth entry
|
2002-04-28 21:16:32 +00:00
|
|
|
|
lookup-name xx patt fd))
|
|
|
|
|
(nm (concat (filesets-get-shortcut count)
|
|
|
|
|
x)))
|
|
|
|
|
(if dd
|
|
|
|
|
`(,nm ,@dd)
|
|
|
|
|
`[,nm ,(list 'filesets-browse-dir xx)])))
|
|
|
|
|
subdirs))
|
|
|
|
|
(files (filesets-filter-dir-names dirlist t))
|
|
|
|
|
(filesmenu (mapcar (lambda (x)
|
|
|
|
|
(setq count (+ count 1))
|
|
|
|
|
`[,(concat (filesets-get-shortcut count)
|
|
|
|
|
x)
|
|
|
|
|
(filesets-file-open nil
|
|
|
|
|
(quote ,(concat dir x))
|
|
|
|
|
(quote ,lookup-name))])
|
|
|
|
|
files)))
|
|
|
|
|
(append header
|
|
|
|
|
(filesets-wrap-submenu
|
|
|
|
|
(append
|
|
|
|
|
dirsmenu
|
|
|
|
|
filesmenu))
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(filesets-get-menu-epilog `(,dir ,patt) ':tree
|
2002-04-28 21:16:32 +00:00
|
|
|
|
lookup-name rebuild-flag)))
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
(defun filesets-build-dir-submenu (entry lookup-name dir patt)
|
|
|
|
|
"Build a :tree submenu named LOOKUP-NAME with base directory DIR including
|
|
|
|
|
all files matching PATT for filesets ENTRY."
|
|
|
|
|
(let ((fd (filesets-entry-get-filter-dirs-flag entry))
|
|
|
|
|
(depth (or (filesets-entry-get-tree-max-level entry)
|
|
|
|
|
filesets-tree-max-level)))
|
|
|
|
|
(filesets-build-dir-submenu-now 0 depth entry lookup-name dir patt fd t)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-build-submenu (count lookup-name entry)
|
|
|
|
|
"Build submenu for the fileset ENTRY named LOOKUP-NAME.
|
|
|
|
|
Construct a shortcut from COUNT."
|
|
|
|
|
(let ((lookup-name (or lookup-name
|
|
|
|
|
(filesets-data-get-name entry))))
|
|
|
|
|
(message "Filesets: %s" lookup-name)
|
|
|
|
|
(let ((mode (filesets-entry-mode entry))
|
|
|
|
|
(filesets-verbosity (filesets-entry-get-verbosity entry))
|
|
|
|
|
(this-lookup-name (concat (filesets-get-shortcut count)
|
|
|
|
|
lookup-name)))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(pcase mode
|
|
|
|
|
(:file
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let* ((file (filesets-entry-get-file entry)))
|
|
|
|
|
`[,this-lookup-name
|
|
|
|
|
(filesets-file-open nil ',file ',lookup-name)]))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(_
|
2002-04-28 21:16:32 +00:00
|
|
|
|
`(,this-lookup-name
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
,@(pcase mode
|
|
|
|
|
(:pattern
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let* ((files (filesets-get-filelist entry mode 'on-ls))
|
|
|
|
|
(dirpatt (filesets-entry-get-pattern entry))
|
|
|
|
|
(pattname (apply 'concat (cons "Pattern: " dirpatt)))
|
|
|
|
|
(count 0))
|
|
|
|
|
;;(filesets-message 3 "Filesets: scanning %S" pattname)
|
|
|
|
|
`([,pattname
|
|
|
|
|
,(list (function filesets-open) mode lookup-name)]
|
|
|
|
|
"---"
|
|
|
|
|
,@(filesets-wrap-submenu
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(setq count (+ count 1))
|
|
|
|
|
`[,(concat (filesets-get-shortcut count)
|
|
|
|
|
(file-name-nondirectory x))
|
|
|
|
|
(filesets-file-open nil ',x ',lookup-name)])
|
|
|
|
|
files))
|
|
|
|
|
,@(filesets-get-menu-epilog lookup-name mode
|
|
|
|
|
lookup-name t))))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:ingroup
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let* ((master (filesets-entry-get-master entry)))
|
|
|
|
|
;;(filesets-message 3 "Filesets: parsing %S" master)
|
|
|
|
|
`([,(concat "Inclusion Group: "
|
|
|
|
|
(file-name-nondirectory master))
|
|
|
|
|
(filesets-open ',mode ',master ',lookup-name)]
|
|
|
|
|
"---"
|
|
|
|
|
[,master (filesets-file-open nil ',master ',lookup-name)]
|
|
|
|
|
"---"
|
|
|
|
|
,@(filesets-wrap-submenu
|
|
|
|
|
(filesets-build-ingroup-submenu lookup-name master))
|
|
|
|
|
,@(filesets-get-menu-epilog master mode lookup-name t))))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:tree
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let* ((dirpatt (filesets-entry-get-tree entry))
|
|
|
|
|
(dir (car dirpatt))
|
|
|
|
|
(patt (cadr dirpatt)))
|
|
|
|
|
(filesets-build-dir-submenu entry lookup-name dir patt)))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(:files
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((files (filesets-get-filelist entry mode 'on-open-all))
|
|
|
|
|
(count 0))
|
|
|
|
|
`([,(concat "Files: " lookup-name)
|
|
|
|
|
(filesets-open ',mode ',lookup-name)]
|
|
|
|
|
"---"
|
|
|
|
|
,@(filesets-wrap-submenu
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(setq count (+ count 1))
|
|
|
|
|
`[,(concat (filesets-get-shortcut count)
|
|
|
|
|
(file-name-nondirectory x))
|
|
|
|
|
(filesets-file-open nil ',x ',lookup-name)])
|
|
|
|
|
(filesets-conditional-sort
|
|
|
|
|
files
|
|
|
|
|
(function file-name-nondirectory))))
|
|
|
|
|
,@(filesets-get-menu-epilog lookup-name mode
|
|
|
|
|
lookup-name t)))))))))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-remove-from-ubl (&optional buffer)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
"BUFFER or current buffer require update of the filesets menu."
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(let ((b (or buffer
|
|
|
|
|
(current-buffer))))
|
|
|
|
|
(if (member b filesets-updated-buffers)
|
|
|
|
|
(setq filesets-updated-buffers
|
|
|
|
|
(delete b filesets-updated-buffers)))))
|
|
|
|
|
|
|
|
|
|
(defun filesets-build-menu-now (from-scratch-flag)
|
|
|
|
|
"Update the filesets menu.
|
|
|
|
|
Build all new if FROM-SCRATCH-FLAG is non-nil. (To really build from the
|
|
|
|
|
bottom up, set `filesets-submenus' to nil, first.)"
|
|
|
|
|
(when (or from-scratch-flag
|
|
|
|
|
filesets-has-changed-flag
|
|
|
|
|
(not filesets-menu-cache))
|
|
|
|
|
(setq filesets-menu-cache nil)
|
|
|
|
|
(setq filesets-has-changed-flag nil)
|
|
|
|
|
(setq filesets-updated-buffers nil)
|
|
|
|
|
(setq filesets-update-cache-file-flag t)
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
(cl-do ((data (filesets-conditional-sort filesets-data (function car))
|
|
|
|
|
(cdr data))
|
|
|
|
|
(count 1 (+ count 1)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
((null data))
|
|
|
|
|
(let* ((this (car data))
|
|
|
|
|
(name (filesets-data-get-name this))
|
|
|
|
|
(cached (lax-plist-get filesets-submenus name))
|
|
|
|
|
(submenu (or cached
|
|
|
|
|
(filesets-build-submenu count name this))))
|
|
|
|
|
(unless cached
|
|
|
|
|
(setq filesets-submenus
|
|
|
|
|
(lax-plist-put filesets-submenus name submenu)))
|
|
|
|
|
(unless (filesets-entry-get-dormant-flag this)
|
|
|
|
|
(setq filesets-menu-cache
|
|
|
|
|
(append filesets-menu-cache (list submenu))))))
|
|
|
|
|
(when filesets-cache-save-often-flag
|
|
|
|
|
(filesets-menu-cache-file-save-maybe)))
|
|
|
|
|
(let ((cb (current-buffer)))
|
|
|
|
|
(when (not (member cb filesets-updated-buffers))
|
2005-03-30 15:14:55 +00:00
|
|
|
|
(add-submenu
|
2002-04-28 21:16:32 +00:00
|
|
|
|
filesets-menu-path
|
|
|
|
|
`(,filesets-menu-name
|
|
|
|
|
("# Filesets"
|
|
|
|
|
["Edit Filesets" filesets-edit]
|
|
|
|
|
["Save Filesets" filesets-save-config]
|
|
|
|
|
["Save Menu Cache" filesets-menu-cache-file-save]
|
|
|
|
|
["Rebuild Menu" filesets-build-menu]
|
|
|
|
|
["Customize" filesets-customize]
|
|
|
|
|
["About" filesets-info])
|
|
|
|
|
,(filesets-get-cmd-menu)
|
|
|
|
|
"---"
|
|
|
|
|
,@filesets-menu-cache)
|
|
|
|
|
filesets-menu-before
|
|
|
|
|
filesets-menu-in-menu)
|
|
|
|
|
(setq filesets-updated-buffers
|
|
|
|
|
(cons cb filesets-updated-buffers))
|
2002-12-16 01:47:18 +00:00
|
|
|
|
;; This wipes out other messages in the echo area.
|
|
|
|
|
;; (message nil)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
;;(message "Filesets updated: %s" cb)
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-build-menu-maybe ()
|
|
|
|
|
"Update the filesets menu."
|
|
|
|
|
(interactive)
|
|
|
|
|
(filesets-build-menu-now nil))
|
|
|
|
|
|
|
|
|
|
(defun filesets-build-menu ()
|
|
|
|
|
"Force rebuild of the filesets menu."
|
|
|
|
|
(interactive)
|
|
|
|
|
;(setq filesets-submenus nil)
|
|
|
|
|
(filesets-reset-fileset)
|
|
|
|
|
(filesets-build-menu-now t)
|
|
|
|
|
(filesets-menu-cache-file-save-maybe))
|
|
|
|
|
|
|
|
|
|
(defun filesets-rebuild-this-submenu (fileset)
|
|
|
|
|
"Force rebuild of FILESET submenu."
|
|
|
|
|
(filesets-reset-fileset fileset)
|
|
|
|
|
(filesets-build-menu-now t))
|
|
|
|
|
|
|
|
|
|
(defun filesets-menu-cache-file-save-maybe (&optional simply-do-it)
|
|
|
|
|
"Write filesets' cache file.
|
|
|
|
|
If SIMPLY-DO-IT is non-nil, the cache file will be written no matter if
|
|
|
|
|
fileset thinks this is necessary or not."
|
|
|
|
|
(when (and (not (equal filesets-menu-cache-file ""))
|
|
|
|
|
(or simply-do-it
|
|
|
|
|
filesets-update-cache-file-flag))
|
|
|
|
|
(when (file-exists-p filesets-menu-cache-file)
|
|
|
|
|
(delete-file filesets-menu-cache-file))
|
|
|
|
|
;;(message "Filesets: saving menu cache")
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(dolist (this filesets-menu-cache-contents)
|
|
|
|
|
(if (get this 'custom-type)
|
2003-01-27 08:44:27 +00:00
|
|
|
|
(progn
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(insert (format "(setq-default %s '%S)" this (eval this)))
|
|
|
|
|
(when filesets-menu-ensure-use-cached
|
|
|
|
|
(newline)
|
|
|
|
|
(insert (format "(setq %s (cons '%s %s))"
|
|
|
|
|
'filesets-ignore-next-set-default
|
|
|
|
|
this
|
|
|
|
|
'filesets-ignore-next-set-default))))
|
|
|
|
|
(insert (format "(setq %s '%S)" this (eval this))))
|
|
|
|
|
(newline 2))
|
|
|
|
|
(insert (format "(setq filesets-cache-version %S)" filesets-version))
|
|
|
|
|
(newline 2)
|
|
|
|
|
(when filesets-cache-hostname-flag
|
|
|
|
|
(insert (format "(setq filesets-cache-hostname %S)" (system-name)))
|
|
|
|
|
(newline 2))
|
2012-10-23 15:06:07 +00:00
|
|
|
|
(run-hooks 'filesets-cache-fill-content-hook)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(write-file filesets-menu-cache-file))
|
|
|
|
|
(setq filesets-has-changed-flag nil)
|
|
|
|
|
(setq filesets-update-cache-file-flag nil)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-menu-cache-file-save ()
|
|
|
|
|
"Save filesets' menu cache file."
|
|
|
|
|
(interactive)
|
|
|
|
|
(filesets-menu-cache-file-save-maybe t))
|
|
|
|
|
|
|
|
|
|
(defun filesets-update-cleanup ()
|
|
|
|
|
"Rebuild the menu and save the cache file after updating user data."
|
|
|
|
|
(interactive)
|
|
|
|
|
(message "Filesets v%s: updating menu & cache from version %s"
|
|
|
|
|
filesets-version (or filesets-cache-version "???"))
|
|
|
|
|
(filesets-build-menu)
|
|
|
|
|
(filesets-menu-cache-file-save-maybe)
|
|
|
|
|
(filesets-menu-cache-file-load))
|
|
|
|
|
|
|
|
|
|
(defun filesets-update-pre010505 ()
|
|
|
|
|
(let ((msg
|
|
|
|
|
"Filesets: manual editing of user data required!
|
|
|
|
|
|
|
|
|
|
Filesets has detected that you were using an older version before,
|
|
|
|
|
which requires some manual updating. Type 'y' for editing the startup
|
|
|
|
|
file now.
|
|
|
|
|
|
|
|
|
|
The layout of `filesets-data' has changed. Please delete your cache file
|
|
|
|
|
and edit your startup file as shown below:
|
|
|
|
|
|
|
|
|
|
1. `filesets-data': Edit all :pattern filesets in your startup file and
|
|
|
|
|
transform all entries as shown in this example:
|
|
|
|
|
|
|
|
|
|
\(\"Test\" (:pattern \"~/dir/^pattern$\"))
|
|
|
|
|
--> \(\"Test\" (:pattern \"~/dir/\" \"^pattern$\"))
|
|
|
|
|
|
2002-06-18 14:34:53 +00:00
|
|
|
|
2. `filesets-data': Change all occurrences of \":document\" to \":ingroup\":
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
\(\(\"Test\" \(:document \"~/dir/file\"))
|
|
|
|
|
--> \(\(\"Test\" \(:ingroup \"~/dir/file\"))
|
|
|
|
|
|
|
|
|
|
3. `filesets-subdocument-patterns': If you already modified the variable
|
|
|
|
|
previously called `filesets-subdocument-patterns', change its name to
|
|
|
|
|
`filesets-ingroup-patterns'.
|
|
|
|
|
|
|
|
|
|
4. `filesets-menu-cache-contents': If you already modified this
|
|
|
|
|
variable, change the entry `filesets-subdocument--cache' to
|
|
|
|
|
`filesets-ingroup-cache'.
|
|
|
|
|
|
|
|
|
|
5. Type M-x filesets-update-cleanup and restart Emacs.
|
|
|
|
|
|
|
|
|
|
We apologize for the inconvenience."))
|
|
|
|
|
(let* ((cf (or custom-file user-init-file)))
|
|
|
|
|
(switch-to-buffer-other-frame "*Filesets update*")
|
|
|
|
|
(insert msg)
|
|
|
|
|
(when (y-or-n-p (format "Edit startup (%s) file now? " cf))
|
|
|
|
|
(find-file-other-window cf))
|
|
|
|
|
(filesets-error 'error msg))))
|
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(defun filesets-update (cached-version)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
"Do some cleanup after updating filesets.el."
|
|
|
|
|
(cond
|
|
|
|
|
((or (not cached-version)
|
|
|
|
|
(string< cached-version "1.5.5")
|
|
|
|
|
(boundp 'filesets-subdocument-patterns))
|
|
|
|
|
(filesets-update-pre010505)))
|
|
|
|
|
(filesets-update-cleanup))
|
|
|
|
|
|
|
|
|
|
(defun filesets-menu-cache-file-load ()
|
|
|
|
|
"Load filesets' menu cache file."
|
|
|
|
|
(cond
|
|
|
|
|
((and (not (equal filesets-menu-cache-file ""))
|
|
|
|
|
(file-readable-p filesets-menu-cache-file))
|
|
|
|
|
(load-file filesets-menu-cache-file)
|
|
|
|
|
(if (and (equal filesets-cache-version filesets-version)
|
|
|
|
|
(if filesets-cache-hostname-flag
|
|
|
|
|
(equal filesets-cache-hostname (system-name))
|
|
|
|
|
t))
|
|
|
|
|
(progn
|
|
|
|
|
(setq filesets-update-cache-file-flag nil)
|
|
|
|
|
t)
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(filesets-update filesets-cache-version)))
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(t
|
|
|
|
|
(setq filesets-update-cache-file-flag t)
|
|
|
|
|
nil)))
|
|
|
|
|
|
|
|
|
|
(defun filesets-exit ()
|
|
|
|
|
(filesets-menu-cache-file-save-maybe))
|
|
|
|
|
|
2005-03-26 02:14:35 +00:00
|
|
|
|
;;;###autoload
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(defun filesets-init ()
|
|
|
|
|
"Filesets initialization.
|
|
|
|
|
Set up hooks, load the cache file -- if existing -- and build the menu."
|
2007-09-19 15:16:31 +00:00
|
|
|
|
(add-hook (if (featurep 'xemacs) 'activate-menubar-hook 'menu-bar-update-hook)
|
2002-04-28 21:16:32 +00:00
|
|
|
|
(function filesets-build-menu-maybe))
|
|
|
|
|
(add-hook 'kill-buffer-hook (function filesets-remove-from-ubl))
|
|
|
|
|
(add-hook 'first-change-hook (function filesets-reset-filename-on-change))
|
|
|
|
|
(add-hook 'kill-emacs-hook (function filesets-exit))
|
|
|
|
|
(if (filesets-menu-cache-file-load)
|
|
|
|
|
(progn
|
|
|
|
|
(filesets-build-menu-maybe)
|
|
|
|
|
;;Well, normally when we use XEmacs <= 21.4, custom.el is loaded
|
|
|
|
|
;;after init.el. This more or less ignores the next
|
|
|
|
|
;;`filesets-data-set-default'
|
|
|
|
|
(if filesets-menu-ensure-use-cached
|
|
|
|
|
(setq filesets-menu-use-cached-flag t)))
|
|
|
|
|
(filesets-build-menu)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(provide 'filesets)
|
|
|
|
|
|
2007-09-19 15:16:31 +00:00
|
|
|
|
;; Local Variables:
|
|
|
|
|
;; sentence-end-double-space:t
|
|
|
|
|
;; End:
|
2002-04-28 21:16:32 +00:00
|
|
|
|
|
|
|
|
|
;;; filesets.el ends here
|