unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: desktop and tilde-expand-file-name
@ 2003-02-18 22:04 Lars Hansen
  2003-02-19  0:01 ` Kim F. Storm
  2003-02-19 10:51 ` Richard Stallman
  0 siblings, 2 replies; 12+ messages in thread
From: Lars Hansen @ 2003-02-18 22:04 UTC (permalink / raw)
  Cc: emacs-devel

I have nearly finished my work on the desktop module, and I would like
to ask what the procedures are for comitting changes, or where to obtain 
such informations. I have not tried to do this before.

^ permalink raw reply	[flat|nested] 12+ messages in thread
* desktop and tilde-expand-file-name
@ 2002-12-29  9:14 Lars Hansen
  2002-12-29 11:45 ` Kai Großjohann
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Hansen @ 2002-12-29  9:14 UTC (permalink / raw)


Hi

I have written some enhancements for the desktop module, and I would 
like to propose them for the Emacs distribution. A description of the 
enhancements is included below. But I have two questions:

1. How do I do? I have not participated in Emacs development before, and 
I don't have CVS.
2. For use in the desktop module, I need a function 
`tilde-expand-file-name' that should work like `expand-file-name' except 
that path is specified from "~" rather than from root when that is 
possible. Such a function allows desktop modules to be portable. But the 
implementation, listed below, is not good. Can anyone sugest something 
better? In particular the implementation should not refer to Tramp.

;;;###autoload
(defun tilde-expand-file-name (file-name &optional default-dir)
;; Don't use parameter name `default-directory' here! Then 
`expand-file-name' will
;; see the parameter instead of the buffer-local variable of the same name.
"Works like `expand-file-name' except that path is specified from \"~\"
rather than form root when possible.
\(It can be impossible on MSDOS and Windows when the FILE-NAME and \"~\"
are on different drives.)
"
   (if
      (and
         (fboundp 'tramp-tramp-file-p)
         (or
            (tramp-tramp-file-p file-name)
            (and default-dir (tramp-tramp-file-p default-dir))
            (and (not default-dir) (tramp-tramp-file-p default-directory))
         )
      )
      (expand-file-name file-name default-dir)
      (let (
         (relative-name (file-relative-name (expand-file-name file-name 
default-dir) "~"))
      )
         (cond
            ((file-name-absolute-p relative-name) relative-name)
            ((string= "./" relative-name) "~/")
            ((string= "." relative-name) "~")
            (t (concat "~/" relative-name))
         )
      )
   )
)

Enhancements for the desktop module:

;;  1. Customizable variable `desktop-save' introduced.
;;     When the user changes desktop or quits emacs, should the desktop 
be saved?
;;        t          -- Allways save.
;;        ask        -- Ask.
;;        ask-if-new -- Ask if no desktop file exists, otherwise just save.
;;        nil        -- Never.
;;     The desktop is never saved when `desktop-enable' is nil"
;;  2. Customizable variable `desktop-path' introduced.
;;     List of directories in which to lookup the desktop file.
;;  3. Customizable hook `desktop-after-read-hook' introduced.
;;     It is run after a desktop is read. It can be used to e.g. show a 
buffer list.
;;  4. Customizable hook `desktop-no-desktop-file-hook' introduced.
;;     It is run when no desktop file is found. By default a dired 
buffer is shown.
;;  5. Customizable variable `desktop-globals-to-save' introduced.
;;  6. Customizable variable `desktop-globals-to-clear' introduced.
;;  7. Command line option --no-desktop introduced.
;;     When this is specified, no desktop file is loaded.
;;  8. Functions `desktop-create-buffer' and 
`desktop-buffer-dired-misc-data' write file
;;     names in portable form using `tilde-expand-file-name'.
;;  9. Previously the desktop module wrote buffers in the desktop file 
in the reverse order
;;     of the buffer list. Morover restoring buffers in the same order 
depended on handlers
;;     to not change the order of the buffer list and to put newly 
created buffers at the
;;     top of the list. The new module writes buffers in the desktop 
file in the same order
;;     as the buffer list, and the dependence of handlers just described 
is removed. The
;;     change is backwards compatible in the sense that old desktop 
files are handled in the
;;     same way as the were with the old module.
;; 10. New function `desktop-change-dir'.
;;     Saves and clears the desktop, changes to directory DIR and loads 
the desktop there
;;     indepentently of the value of `desktop-path'.
;;     If `desktop-enable' was nil at call, the desktop is not saved, 
but `desktop-enable' is
;;     subsequently set to t.
;; 11. New function `desktop-save-in-load-dir'.
;;     Save desktop in directory from witch it was loaded.
;; 12. New function `desktop-revert'. Revert to the last loaded desktop.

Lars Hansen

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-02-19 20:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-18 22:04 desktop and tilde-expand-file-name Lars Hansen
2003-02-19  0:01 ` Kim F. Storm
2003-02-19  9:22   ` Lars Hansen
     [not found]     ` <84heb0wnc9.fsf@lucy.is.informatik.uni-duisburg.de>
2003-02-19 11:09       ` Lars Hansen
2003-02-19 15:43     ` Reiner Steib
2003-02-19 17:18       ` Lars Hansen
2003-02-19 18:57       ` Kim F. Storm
2003-02-19 20:54         ` Lars Hansen
2003-02-19 10:51 ` Richard Stallman
2003-02-19 10:56   ` Lars Hansen
  -- strict thread matches above, loose matches on Subject: below --
2002-12-29  9:14 Lars Hansen
2002-12-29 11:45 ` Kai Großjohann

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).