Mercurial > emacs
comparison lisp/filesets.el @ 45132:c26266baaba5
(filesets-browse-dir-function): Renamed from ...-fn.
(filesets-open-file-function, filesets-save-buffer-function): Likewise.
(filesets-tree-max-level): Doc fix.
(filesets-commands, filesets-external-viewers)
(filesets-ingroup-patterns): Mark as risky.
(filesets-cache-hostname-flag): Doc fix.
(filesets-menu-cache-file): Doc fix. Mark as risky.
(filesets-menu-before, filesets-menu-path, filesets-menu-in-menu):
Don't defcustom them if running in Emacs.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 05 May 2002 01:55:25 +0000 |
parents | cb1d1e1eb678 |
children | 79ab9956f2a0 |
comparison
equal
deleted
inserted
replaced
45131:92db9a8c97d7 | 45132:c26266baaba5 |
---|---|
260 "*Filesets' menu name." | 260 "*Filesets' menu name." |
261 :set (function filesets-set-default) | 261 :set (function filesets-set-default) |
262 :type 'sexp | 262 :type 'sexp |
263 :group 'filesets) | 263 :group 'filesets) |
264 | 264 |
265 (defcustom filesets-menu-path nil | 265 (when filesets-running-xemacs |
266 "*The menu under which the filesets menu should be inserted. | 266 (defcustom filesets-menu-path nil |
267 "*The menu under which the filesets menu should be inserted. | |
267 XEmacs specific; see `add-submenu' for documentation." | 268 XEmacs specific; see `add-submenu' for documentation." |
268 :set (function filesets-set-default) | 269 :set (function filesets-set-default) |
269 :type 'sexp | 270 :type 'sexp |
270 :group 'filesets) | 271 :group 'filesets) |
271 | 272 |
272 (defcustom filesets-menu-before "File" | 273 (defcustom filesets-menu-before "File" |
273 "*The name of a menu before which this menu should be added. | 274 "*The name of a menu before which this menu should be added. |
274 XEmacs specific; see `add-submenu' for documentation." | 275 XEmacs specific; see `add-submenu' for documentation." |
275 :set (function filesets-set-default) | 276 :set (function filesets-set-default) |
276 :type 'sexp | 277 :type 'sexp |
277 :group 'filesets) | 278 :group 'filesets) |
278 | 279 |
279 (defcustom filesets-menu-in-menu nil | 280 (defcustom filesets-menu-in-menu nil |
280 "*Use that instead of `current-menubar' as the menu to change. | 281 "*Use that instead of `current-menubar' as the menu to change. |
281 XEmacs specific; see `add-submenu' for documentation." | 282 XEmacs specific; see `add-submenu' for documentation." |
282 :set (function filesets-set-default) | 283 :set (function filesets-set-default) |
283 :type 'sexp | 284 :type 'sexp |
284 :group 'filesets) | 285 :group 'filesets)) |
285 | 286 |
286 (defcustom filesets-menu-shortcuts-flag t | 287 (defcustom filesets-menu-shortcuts-flag t |
287 "*Non-nil means to prepend menus with hopefully unique shortcuts." | 288 "*Non-nil means to prepend menus with hopefully unique shortcuts." |
288 :set (function filesets-set-default!) | 289 :set (function filesets-set-default!) |
289 :type 'boolean | 290 :type 'boolean |
303 | 304 |
304 (defcustom filesets-menu-cache-file | 305 (defcustom filesets-menu-cache-file |
305 (if filesets-running-xemacs | 306 (if filesets-running-xemacs |
306 "~/.xemacs/filesets-cache.el" | 307 "~/.xemacs/filesets-cache.el" |
307 "~/.filesets-cache.el") | 308 "~/.filesets-cache.el") |
308 "*File to be used for saving the filesets menu between (X)Emacs | 309 "*File to be used for saving the filesets menu between sessions. |
309 sessions. Set this to \"\", to disable caching of menus. | 310 Set this to \"\", to disable caching of menus. |
310 Don't forget to check out `filesets-menu-ensure-use-cached'." | 311 Don't forget to check out `filesets-menu-ensure-use-cached'." |
311 :set (function filesets-set-default) | 312 :set (function filesets-set-default) |
312 :type 'file | 313 :type 'file |
313 :group 'filesets) | 314 :group 'filesets) |
315 (put 'filesets-menu-cache-file 'risky-local-variable t) | |
314 | 316 |
315 (defcustom filesets-menu-cache-contents | 317 (defcustom filesets-menu-cache-contents |
316 '(filesets-be-docile-flag | 318 '(filesets-be-docile-flag |
317 filesets-submenus | 319 filesets-submenus |
318 filesets-menu-cache | 320 filesets-menu-cache |
376 :set (function filesets-set-default) | 378 :set (function filesets-set-default) |
377 :type 'hook | 379 :type 'hook |
378 :group 'filesets) | 380 :group 'filesets) |
379 | 381 |
380 (defcustom filesets-cache-hostname-flag nil | 382 (defcustom filesets-cache-hostname-flag nil |
381 "*Non-nil means cache the hostname. If the current name differs from | 383 "*Non-nil means cache the hostname. |
382 the cached one, rebuild the menu and create a new cache file." | 384 If the current name differs from the cached one, |
385 rebuild the menu and create a new cache file." | |
383 :set (function filesets-set-default) | 386 :set (function filesets-set-default) |
384 :type 'boolean | 387 :type 'boolean |
385 :group 'filesets) | 388 :group 'filesets) |
386 | 389 |
387 (defcustom filesets-cache-save-often-flag nil | 390 (defcustom filesets-cache-save-often-flag nil |
405 "*Truncate names of splitted submenus to this length." | 408 "*Truncate names of splitted submenus to this length." |
406 :set (function filesets-set-default) | 409 :set (function filesets-set-default) |
407 :type 'integer | 410 :type 'integer |
408 :group 'filesets) | 411 :group 'filesets) |
409 | 412 |
410 (defcustom filesets-browse-dir-fn 'dired | 413 (defcustom filesets-browse-dir-function 'dired |
411 "*A function or command used for browsing directories. | 414 "*A function or command used for browsing directories. |
412 When using an external command, \"%s\" will be replaced with the | 415 When using an external command, \"%s\" will be replaced with the |
413 directory's name. | 416 directory's name. |
414 | 417 |
415 Note: You have to manually rebuild the menu if you change this value." | 418 Note: You have to manually rebuild the menu if you change this value." |
423 (string :tag "Arguments")) | 426 (string :tag "Arguments")) |
424 (function :tag "Function" | 427 (function :tag "Function" |
425 :value nil)) | 428 :value nil)) |
426 :group 'filesets) | 429 :group 'filesets) |
427 | 430 |
428 (defcustom filesets-open-file-fn 'filesets-find-or-display-file | 431 (defcustom filesets-open-file-function 'filesets-find-or-display-file |
429 "*The function used for opening files. | 432 "*The function used for opening files. |
430 | 433 |
431 `filesets-find-or-display-file' ... Filesets' default function for | 434 `filesets-find-or-display-file' ... Filesets' default function for |
432 visiting files. This function checks if an external viewer is defined | 435 visiting files. This function checks if an external viewer is defined |
433 for a specific file type. Either this viewer, if defined, or | 436 for a specific file type. Either this viewer, if defined, or |
446 :value filesets-find-file) | 449 :value filesets-find-file) |
447 (function :tag "Function" | 450 (function :tag "Function" |
448 :value nil)) | 451 :value nil)) |
449 :group 'filesets) | 452 :group 'filesets) |
450 | 453 |
451 (defcustom filesets-save-buffer-fn 'save-buffer | 454 (defcustom filesets-save-buffer-function 'save-buffer |
452 "*The function used to save a buffer. | 455 "*The function used to save a buffer. |
453 Caveat: Changes will take effect after rebuilding the menu." | 456 Caveat: Changes will take effect after rebuilding the menu." |
454 :set (function filesets-set-default) | 457 :set (function filesets-set-default) |
455 :type '(choice :tag "Function:" | 458 :type '(choice :tag "Function:" |
456 (const :tag "save-buffer" | 459 (const :tag "save-buffer" |
493 :group 'filesets) | 496 :group 'filesets) |
494 | 497 |
495 (defcustom filesets-tree-max-level 3 | 498 (defcustom filesets-tree-max-level 3 |
496 "*Maximum scan depth for directory trees. | 499 "*Maximum scan depth for directory trees. |
497 A :tree fileset is defined by a base directory the contents of which | 500 A :tree fileset is defined by a base directory the contents of which |
498 will be recursively added to the menu. filesets-tree-max-level tells up | 501 will be recursively added to the menu. `filesets-tree-max-level' tells up |
499 to which level the directory structure should be scanned/listed, | 502 to which level the directory structure should be scanned/listed, |
500 i.e. how deep the menu should be. Try something like | 503 i.e. how deep the menu should be. Try something like |
501 | 504 |
502 \(\"HOME -- only one level\" | 505 \(\"HOME -- only one level\" |
503 \(:tree \"~\" \"^[^.].*[^~]$\") | 506 \(:tree \"~\" \"^[^.].*[^~]$\") |
549 (string :tag "Quoted File Name" | 552 (string :tag "Quoted File Name" |
550 :value "<<file-name>>") | 553 :value "<<file-name>>") |
551 (function :tag "Function" | 554 (function :tag "Function" |
552 :value nil))))) | 555 :value nil))))) |
553 :group 'filesets) | 556 :group 'filesets) |
557 (put 'filesets-commands 'risky-local-variable t) | |
554 | 558 |
555 (defcustom filesets-external-viewers | 559 (defcustom filesets-external-viewers |
556 (let | 560 (let |
557 ; ((ps-cmd (or (and (boundp 'my-ps-viewer) my-ps-viewer) | 561 ; ((ps-cmd (or (and (boundp 'my-ps-viewer) my-ps-viewer) |
558 ; (filesets-select-command "ggv gv"))) | 562 ; (filesets-select-command "ggv gv"))) |
692 :value (:capture-output t) | 696 :value (:capture-output t) |
693 (const :format "" | 697 (const :format "" |
694 :value :capture-output) | 698 :value :capture-output) |
695 (boolean :tag "Boolean")))))) | 699 (boolean :tag "Boolean")))))) |
696 :group 'filesets) | 700 :group 'filesets) |
697 | 701 (put 'filesets-external-viewers 'risky-local-variable t) |
698 | 702 |
699 (defcustom filesets-ingroup-patterns | 703 (defcustom filesets-ingroup-patterns |
700 '(("^.+\\.tex$" t | 704 '(("^.+\\.tex$" t |
701 (((:name "Package") | 705 (((:name "Package") |
702 (:pattern "\\\\usepackage\\W*\\(\\[[^\]]*\\]\\W*\\)?{\\W*\\(.+\\)\\W*}") | 706 (:pattern "\\\\usepackage\\W*\\(\\[[^\]]*\\]\\W*\\)?{\\W*\\(.+\\)\\W*}") |
880 (list :tag ":preprocess" | 884 (list :tag ":preprocess" |
881 :value (:preprocess) | 885 :value (:preprocess) |
882 (const :format "" :value :preprocess) | 886 (const :format "" :value :preprocess) |
883 (function :tag "Function"))))))) | 887 (function :tag "Function"))))))) |
884 :group 'filesets) | 888 :group 'filesets) |
889 (put 'filesets-ingroup-patterns 'risky-local-variable t) | |
885 | 890 |
886 (defcustom filesets-data | 891 (defcustom filesets-data |
887 nil | 892 nil |
888 "*Fileset definitions. | 893 "*Fileset definitions. |
889 | 894 |
943 i.e. these tags are mutually exclusive. The fields :open and :save are | 948 i.e. these tags are mutually exclusive. The fields :open and :save are |
944 optional. | 949 optional. |
945 | 950 |
946 In conjunction with the :tree tag, :save is void. :open refers to the | 951 In conjunction with the :tree tag, :save is void. :open refers to the |
947 function used for opening files in a directory, not for opening the | 952 function used for opening files in a directory, not for opening the |
948 directory. For browsing directories, `filesets-browse-dir-fn' is used. | 953 directory. For browsing directories, `filesets-browse-dir-function' is used. |
949 | 954 |
950 Before using :ingroup, make sure that the file type is already | 955 Before using :ingroup, make sure that the file type is already |
951 defined in `filesets-ingroup-patterns'." | 956 defined in `filesets-ingroup-patterns'." |
952 :group 'filesets | 957 :group 'filesets |
953 :set (function filesets-data-set-default) | 958 :set (function filesets-data-set-default) |
1005 (function :tag "Function")) | 1010 (function :tag "Function")) |
1006 (list :tag "Open function" | 1011 (list :tag "Open function" |
1007 :value (:open) | 1012 :value (:open) |
1008 (const :format "" :value :open) | 1013 (const :format "" :value :open) |
1009 (function :tag "Function"))))))) | 1014 (function :tag "Function"))))))) |
1015 (put 'filesets-data 'risky-local-variable t) | |
1010 | 1016 |
1011 | 1017 |
1012 (defcustom filesets-query-user-limit 15 | 1018 (defcustom filesets-query-user-limit 15 |
1013 "*Query the user before opening a fileset with that many files." | 1019 "*Query the user before opening a fileset with that many files." |
1014 :set (function filesets-set-default) | 1020 :set (function filesets-set-default) |
1343 (viewer (completing-read "Using viewer: " lst nil t))) | 1349 (viewer (completing-read "Using viewer: " lst nil t))) |
1344 (when viewer | 1350 (when viewer |
1345 (filesets-find-or-display-file nil (cadr (assoc viewer lst)))))) | 1351 (filesets-find-or-display-file nil (cadr (assoc viewer lst)))))) |
1346 | 1352 |
1347 (defun filesets-browser-name () | 1353 (defun filesets-browser-name () |
1348 "Get the directory browser's name as defined in `filesets-browse-dir-fn'." | 1354 "Get the directory browser's name as defined in `filesets-browse-dir-function'." |
1349 (cond | 1355 (cond |
1350 ((listp filesets-browse-dir-fn) | 1356 ((listp filesets-browse-dir-function) |
1351 (car filesets-browse-dir-fn)) | 1357 (car filesets-browse-dir-function)) |
1352 (t | 1358 (t |
1353 filesets-browse-dir-fn))) | 1359 filesets-browse-dir-function))) |
1354 | 1360 |
1355 (defun filesets-browse-dir (dir) | 1361 (defun filesets-browse-dir (dir) |
1356 "Browse DIR using `filesets-browse-dir-fn'." | 1362 "Browse DIR using `filesets-browse-dir-function'." |
1357 (if (functionp filesets-browse-dir-fn) | 1363 (if (functionp filesets-browse-dir-function) |
1358 (funcall filesets-browse-dir-fn dir) | 1364 (funcall filesets-browse-dir-function dir) |
1359 (let ((name (car filesets-browse-dir-fn)) | 1365 (let ((name (car filesets-browse-dir-function)) |
1360 (args (format (cadr filesets-browse-dir-fn) (expand-file-name dir)))) | 1366 (args (format (cadr filesets-browse-dir-function) (expand-file-name dir)))) |
1361 (with-temp-buffer | 1367 (with-temp-buffer |
1362 (start-process (concat "Filesets:" name) | 1368 (start-process (concat "Filesets:" name) |
1363 "*Filesets external directory browser*" | 1369 "*Filesets external directory browser*" |
1364 name args))))) | 1370 name args))))) |
1365 | 1371 |
1416 (defun filesets-entry-get-open-fn (fileset-name &optional fileset-entry) | 1422 (defun filesets-entry-get-open-fn (fileset-name &optional fileset-entry) |
1417 "Get the open-function for FILESET-NAME. | 1423 "Get the open-function for FILESET-NAME. |
1418 Use FILESET-ENTRY for finding the open function, if provided." | 1424 Use FILESET-ENTRY for finding the open function, if provided." |
1419 (filesets-data-get (or fileset-entry | 1425 (filesets-data-get (or fileset-entry |
1420 (filesets-get-fileset-from-name fileset-name)) | 1426 (filesets-get-fileset-from-name fileset-name)) |
1421 ':open filesets-open-file-fn t)) | 1427 ':open filesets-open-file-function t)) |
1422 | 1428 |
1423 (defun filesets-entry-get-save-fn (fileset-name &optional fileset-entry) | 1429 (defun filesets-entry-get-save-fn (fileset-name &optional fileset-entry) |
1424 "Get the save-function for FILESET-NAME. | 1430 "Get the save-function for FILESET-NAME. |
1425 Use FILESET-ENTRY for finding the save function, if provided." | 1431 Use FILESET-ENTRY for finding the save function, if provided." |
1426 (filesets-data-get (or fileset-entry | 1432 (filesets-data-get (or fileset-entry |
1427 (filesets-get-fileset-from-name fileset-name)) | 1433 (filesets-get-fileset-from-name fileset-name)) |
1428 ':save filesets-save-buffer-fn t)) | 1434 ':save filesets-save-buffer-function t)) |
1429 | 1435 |
1430 (defun filesets-entry-get-files (entry) | 1436 (defun filesets-entry-get-files (entry) |
1431 "Get the file list for fileset ENTRY." | 1437 "Get the file list for fileset ENTRY." |
1432 (filesets-data-get entry ':files)) | 1438 (filesets-data-get entry ':files)) |
1433 | 1439 |