• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/

Lines Matching +defs:user +defs:init +defs:file

9 ;; This file is part of GNU Emacs.
32 ;; two mouse clicks only. A fileset is either a list of files, a file
34 ;; inclusion group (i.e. a base file including other files).
37 ;; 1. Put (require 'filesets) and (filesets-init) in your .emacs file.
119 (defvar filesets-update-cache-file-flag nil
140 init.el. This means that settings saved in the cache file (see
141 `filesets-menu-cache-file') will be overwritten by custom.el. In order
142 to ensure the use of the cache file, set this variable to t -- which is
145 file -- before loading filesets.el.
148 is loaded before user customizations. Thus, if (require 'filesets)
149 precedes the custom-set-variables command or, for XEmacs, if init.el is
214 (file-name-nondirectory (substring this 0 (- (length this) 1))))))
232 ;;; config file
244 (setq filesets-update-cache-file-flag (or filesets-update-cache-file-flag
257 (defun filesets-set-default (sym val &optional init-flag)
267 (if init-flag
355 (defcustom filesets-menu-cache-file
363 :type 'file
365 (put 'filesets-menu-cache-file 'risky-local-variable t)
372 "*Stuff we want to save in `filesets-menu-cache-file'.
381 mirrored in the cache file. In this case the version in the cache file
382 is the current one, and the version in your startup file will be
411 "*Hooks to run when writing the contents of filesets' cache file.
413 The hook is called with the cache file as current buffer and the cursor
418 configuration file, you can add a something like this
435 rebuild the menu and create a new cache file."
481 (defcustom filesets-open-file-function 'filesets-find-or-display-file
484 `filesets-find-or-display-file' ... Filesets' default function for
486 for a specific file type. Either this viewer, if defined, or
487 `find-file' will be used to visit a file.
489 `filesets-find-file' ... An alternative function that always uses
490 `find-file'. If `filesets-be-docile-flag' is true, a file, which isn't
496 (const :tag "filesets-find-or-display-file"
497 :value filesets-find-or-display-file)
498 (const :tag "filesets-find-file"
499 :value filesets-find-file)
515 (defcustom filesets-find-file-delay
519 "*Delay before calling find-file.
520 This is for calls via `filesets-find-or-display-file'
521 or `filesets-find-file'.
529 "*Non-nil means don't complain if a file or a directory doesn't exist.
579 ("-n " filesets-get-quoted-selection " " "<<file-name>>"))
587 The argument <file-name> or <<file-name>> (quoted) will be replaced with
601 :value "<file-name>")
603 :value "<<file-name>>")
648 "*Association list of file patterns and external viewers for use with
649 `filesets-find-or-display-file'.
759 (:get-file-name (lambda (master file)
760 (filesets-which-file master
761 (concat file ".sty")
767 (:get-file-name (lambda (master file)
768 (filesets-which-file master
769 (concat file ".tex")
777 (:get-file-name (lambda (master file)
778 (filesets-which-file master
779 (concat file ".tex")
786 (:get-file-name (lambda (master file)
787 (filesets-which-file master
788 (concat file ".bib")
796 (:get-file-name (lambda (master file)
797 (filesets-which-file master
798 (concat file ".el")
803 (:get-file-name (lambda (master file)
804 (filesets-which-file master file load-path))))))
810 (:get-file-name (lambda (master file)
811 (filesets-which-file
813 file
820 Define how to find included file according to a file's mode (being
821 defined by a file pattern).
825 \(mandatory), :name, :get-file-name, :match-number, :scan-depth,
828 File Pattern ... A regexp matching the file's name for which the
832 file is retained. (See below for a full explanation.)
837 include a group that holds the name of the included file.
839 :get-file-name FUNCTION (default: `filesets-which-file') ... A function
840 that takes two arguments (the path of the master file and the name
841 of the included file) and returns a valid path or nil -- if the
854 rescanned. Set this to 0 to disable re-scanning of included file.
857 master file so that pattern matching becomes easier. This is usually
867 First, a stub is a file that shows up in the menu but will not be
868 included in an ingroup's file listing -- i.e. filesets will never
869 operate on this file automatically. Secondly, in opposition to normal
878 E.g. File A and file B refer to file X; X refers to A. If
910 (list :tag ":get-file-name"
911 :value (:get-file-name)
912 (const :format "" :value :get-file-name)
945 A fileset is either a list of files, a file pattern, a base directory
946 and a search pattern (for files), or a base file. Changes to this
956 \(:open filesets-find-file))
970 :ingroup FILE-NAME ... an inclusion group's base file.
972 :tree ROOT-DIR PATTERN ... a base directory and a file pattern
975 and file pattern -- e.g. 'PATH/^REGEXP$'. Note the `^' at the beginning
976 of the file name pattern.
990 :open FUNCTION ... the function used to open file belonging to this
991 fileset. The function takes a file name as argument
993 :save FUNCTION ... the function used to save file belonging to this
1005 Before using :ingroup, make sure that the file type is already
1023 (repeat :tag "Files" file))
1025 :value (:file "~/")
1026 (const :format "" :value :file)
1027 (file :tag "File"))
1031 (file :tag "File" :value "~/"))
1068 (defcustom filesets-query-user-limit 15
1069 "*Query the user before opening a fileset with that many files."
1127 ((file-exists-p dir)
1130 (dolist (this (file-name-all-completions "" dir))
1144 (filesets-message 5 "Filesets: matched file %S with pattern %S"
1147 (concat (file-name-as-directory dir) this)
1195 (equal (expand-file-name a) (expand-file-name b)))
1199 (let ((ad (file-name-directory (expand-file-name a)))
1200 (bd (file-name-directory (expand-file-name b))))
1206 (mapcar (lambda (x) (file-name-as-directory x))
1210 (defun filesets-which-file (master filename &optional path-list)
1211 "Search for a FILENAME relative to a MASTER file in PATH-LIST."
1212 (let ((f (concat (file-name-directory master)
1214 (if (file-exists-p f)
1218 (let ((dir (file-name-as-directory dir))
1219 (files (if (file-exists-p dir)
1222 (filesets-some (lambda (file)
1223 (if (equal filename (file-name-nondirectory file))
1224 (concat dir file)
1246 (defun filesets-get-external-viewer (file)
1248 (let ((filename (file-name-nondirectory file)))
1267 "Returns non-nil if a file of a specific type has special flags/tags.
1306 (set-visited-file-name nil t)))
1308 (defun filesets-spawn-external-viewer (file &optional ev-entry)
1312 (let* ((file (expand-file-name file))
1314 (filesets-get-external-viewer file))))
1317 (co-flag (filesets-filetype-get-prop ':capture-output file entry))
1318 (oh (filesets-filetype-get-prop ':open-hook file entry))
1319 (args (let ((fmt (filesets-filetype-get-prop ':args file entry)))
1326 (format this file))
1332 (format "%S" file))))
1336 (funcall vwr file))
1338 (funcall vwr file)
1347 (switch-to-buffer (format "Filesets: %s %s" vwr file))
1351 (set-visited-file-name file t)
1362 (defun filesets-find-file (file)
1363 "Call `find-file' after a possible delay (see `filesets-find-file-delay').
1364 If `filesets-be-docile-flag' is true, a file, which isn't readable, will
1366 ; (sleep-for filesets-find-file-delay)
1367 (when (or (file-readable-p file)
1369 (sit-for filesets-find-file-delay)
1370 (find-file file)))
1372 (defun filesets-find-or-display-file (&optional file viewer)
1375 (let* ((file (or file
1376 (read-file-name "Find file: " nil nil viewer)))
1379 (filesets-get-external-viewer file))))
1380 (filesets-message 3 "Filesets: view %S using %s" file external-viewer-def)
1382 (filesets-spawn-external-viewer file external-viewer-def)
1383 (filesets-find-file file))))
1385 (defun filesets-find-file-using ()
1386 "Select a viewer and call `filesets-find-or-display-file'."
1394 (filesets-find-or-display-file nil (cadr (assoc viewer lst))))))
1409 (args (format (cadr filesets-browse-dir-function) (expand-file-name dir))))
1457 "Return fileset ENTRY's mode: :files, :file, :tree, :pattern, or :ingroup.
1464 '(:files :tree :pattern :ingroup :file))))
1471 ':open filesets-open-file-function t))
1481 "Get the file list for fileset ENTRY."
1485 "Set the file list for fileset ENTRY."
1494 (defun filesets-entry-get-file (entry)
1495 "Get the single file for fileset ENTRY."
1496 (filesets-data-get entry ':file nil t))
1499 "Get the base directory + file pattern for fileset ENTRY."
1504 "Get the file pattern for LIST."
1506 (file-name-nondirectory (car list))
1510 "Get a file pattern's base directory for LIST."
1512 (file-name-directory (car list))
1535 "Get the base file for fileset ENTRY."
1538 (defun filesets-file-open (open-function file-name &optional fileset-name)
1543 (if (file-readable-p file-name)
1544 (funcall open-function file-name)
1545 (message "Filesets: Couldn't open `%s'" file-name))))
1547 (defun filesets-file-close (save-function buffer)
1603 Replace <file-name> or <<file-name>> with filename."
1605 ((equal arg "<file-name>")
1606 (buffer-file-name))
1607 ((equal arg "<<file-name>>")
1608 (shell-quote-argument (buffer-file-name)))
1637 (let ((buffer (filesets-find-file this)))
1692 (let* ((arg (read-string "Shell command (%s = file): "
1706 (let ((cmd (format txt (shell-quote-argument (buffer-file-name)))))
1721 ((:file)
1722 (list (filesets-entry-get-file entry)))
1724 (let ((entry (expand-file-name
1744 (lambda (file)
1745 (not (filesets-filetype-property file event))))))
1762 (if (or (<= n filesets-query-user-limit)
1766 (filesets-file-open open-function this))
1784 (dolist (file-name files nil)
1785 (let* ((buffer (get-file-buffer file-name)))
1787 (filesets-file-close save-function buffer)))))
1813 (this (buffer-file-name buffer))
1839 (this (buffer-file-name buffer))
2000 (let ((masterfile (file-name-nondirectory master))
2032 (defun filesets-ingroup-cache-put (master file)
2034 (let* ((emaster (expand-file-name master))
2035 (this (if file
2036 (cons file (filesets-ingroup-cache-get emaster))
2042 "Helper function for `filesets-ingroup-collect'. Collect file names."
2062 this-def ':get-file-name 'filesets-which-file t))
2075 (insert-file-contents master)
2131 (file-name-nondirectory master))))
2137 (file-name-nondirectory master))
2140 [,master (filesets-file-open nil ',master ',fsn)]
2153 `([,nm (filesets-file-open nil ',master ',fsn)])))))))))
2164 "Build a :ingroup submenu for file MASTER."
2165 (if (file-readable-p master)
2181 (let* ((dir (file-name-as-directory dir))
2186 (file-name-as-directory
2187 (file-name-nondirectory
2188 (directory-file-name dir))))))
2200 (let* ((x (file-name-as-directory x))
2216 (filesets-file-open nil
2248 ((:file)
2249 (let* ((file (filesets-entry-get-file entry)))
2251 (filesets-file-open nil ',file ',lookup-name)]))
2269 (file-name-nondirectory x))
2270 (filesets-file-open nil ',x ',lookup-name)])
2278 (file-name-nondirectory master))
2281 [,master (filesets-file-open nil ',master ',lookup-name)]
2302 (file-name-nondirectory x))
2303 (filesets-file-open nil ',x ',lookup-name)])
2306 (function file-name-nondirectory))))
2328 (setq filesets-update-cache-file-flag t)
2345 (filesets-menu-cache-file-save-maybe)))
2354 ["Save Menu Cache" filesets-menu-cache-file-save]
2381 (filesets-menu-cache-file-save-maybe))
2388 (defun filesets-menu-cache-file-save-maybe (&optional simply-do-it)
2389 "Write filesets' cache file.
2390 If SIMPLY-DO-IT is non-nil, the cache file will be written no matter if
2392 (when (and (not (equal filesets-menu-cache-file ""))
2394 filesets-update-cache-file-flag))
2395 (when (file-exists-p filesets-menu-cache-file)
2396 (delete-file filesets-menu-cache-file))
2417 (write-file filesets-menu-cache-file))
2419 (setq filesets-update-cache-file-flag nil)))
2421 (defun filesets-menu-cache-file-save ()
2422 "Save filesets' menu cache file."
2424 (filesets-menu-cache-file-save-maybe t))
2427 "Rebuild the menu and save the cache file after updating user data."
2432 (filesets-menu-cache-file-save-maybe)
2433 (filesets-menu-cache-file-load))
2437 "Filesets: manual editing of user data required!
2441 file now.
2443 The layout of `filesets-data' has changed. Please delete your cache file
2444 and edit your startup file as shown below:
2446 1. `filesets-data': Edit all :pattern filesets in your startup file and
2454 \(\(\"Test\" \(:document \"~/dir/file\"))
2455 --> \(\(\"Test\" \(:ingroup \"~/dir/file\"))
2468 (let* ((cf (or custom-file user-init-file)))
2471 (when (y-or-n-p (format "Edit startup (%s) file now? " cf))
2472 (find-file-other-window cf))
2484 (defun filesets-menu-cache-file-load ()
2485 "Load filesets' menu cache file."
2487 ((and (not (equal filesets-menu-cache-file ""))
2488 (file-readable-p filesets-menu-cache-file))
2489 (load-file filesets-menu-cache-file)
2495 (setq filesets-update-cache-file-flag nil)
2499 (setq filesets-update-cache-file-flag t)
2503 (filesets-menu-cache-file-save-maybe))
2506 (defun filesets-init ()
2508 Set up hooks, load the cache file -- if existing -- and build the menu."
2514 (if (filesets-menu-cache-file-load)
2518 ;;after init.el. This more or less ignores the next