/usr/share/emacs/site-lisp/cdargs.el is in cdargs 1.35-10build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | ;;; cdargs.el --- Directory Bookmarks
;; $Id: $
;; Copyright (C) 2003 by Stefan Kamphausen
;; Author: Stefan Kamphausen <mail@skamphausen.de>
;; Keywords: tools, unix
;; This file is not part of XEmacs.
;; This program is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.
;;; Commentary:
;; This is an Emacs front-end to cdargs. It provides a function (cv or
;; cdargs) which uses the same bookmarks list as the terminal program
;; cdargs and lets the user quickly make a directory listed there the
;; current working directory.
;; CDargs is available from
;; http://www.skamphausen.de/software/cdargs/
;;
;;; Installation:
;; Since version 1.24 there is a cdargs.el which you just put
;; somewhere where Emacs can find it (see variable load-path) and the
;; require it in your personal init file (may be one of ~/.emacs,
;; ~/.xemacs/init.el ~/.xemacs/my/config/personal.el or something
;; else):
;; (require 'cdargs)
;; This defines the function cdargs and an alias cv
;;; Code:
(defgroup cdargs nil
"Jump to directories quickly."
:tag "CDargs"
:link '(url-link :tag "Home Page"
"http://www.skamphausen.de/software/cdargs/")
:link '(emacs-commentary-link
:tag "Commentary in cdargs.el" "cdargs.el")
:prefix "cdargs-"
:group 'editing-basics)
(defcustom cdargs-list-file "~/.cdargs"
"The filename of the cdargs bookmarks."
:type 'string
:group 'cdargs)
(defcustom cdargs-warped-hook nil
"List of function to run after changing to a directory with cdargs.
For example it can be useful to add the `desktop-read' function here.
This way you can restore a whole session saved earlier with
desktop-save without having to start Emacs from a terminal.
It's probably a good idea to use some kind of wrapper to check whether
a desktop exists because otherwise it would delete all open buffers:
\(add-hook 'cdargs-warped-hook
'(lambda ()
(when (file-exists-p
(expand-file-name desktop-basefilename \"./\"))
(desktop-read))))"
:type 'hook
:group 'cdargs)
(defun cdargs ()
"Change the current working directory using a bookmarks file.
This function behaves similar to the command line program cdargs
together with which it is distributed.
You can use TAB completion and the usual history repeat keys for
quick access."
(interactive)
(let* ((alist (cdargs-make-list))
(hist (mapcar 'car alist))
(dir (cdr (assoc
(completing-read
"warp to: " alist
nil t nil 'hist nil)
alist))))
(cd dir)
(run-hooks 'cdargs-warped-hook)))
(defalias 'cv 'cdargs)
(defun cdargs-make-list ()
"Return an ALIST with descriptions and paths."
(let ((file (expand-file-name cdargs-list-file))
(the-list) (desc) (path) (start))
(when (file-readable-p file)
(with-temp-buffer
(insert-file-contents file)
(goto-char (point-min))
(while (not (eobp))
(setq
desc (buffer-substring
(point) (- (search-forward " /") 2)))
(setq path (buffer-substring
(- (point) 1) (progn
(end-of-line)
(point))))
(setq the-list
(cons (cons desc path)
the-list))
(forward-line))))
the-list))
(defun cdargs-edit ()
"Simply open the bookmarks file"
(interactive)
(find-file cdargs-list-file))
(provide 'cdargs)
;;; cdargs.el ends here
|