emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: --no-desktop broken?


From: Juri Linkov
Subject: Re: --no-desktop broken?
Date: Mon, 23 Jan 2006 03:51:16 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>> In the long term (i.e., maybe too much to change right now), perhaps
>> we could have arbitrary command-line options handled via Lisp code,
>> with a table or something indicating the file to be loaded or
>> function to be invoked to process the option, and some mechanism akin
>> to loaddefs.el for collecting the options and their help messages
>> from various Lisp files and making them available to be printed out
>> if --help is given.  Aside from actually invoking some Lisp code when
>> --help is given, I think this could mostly be done in new Lisp code.
>
> I agree that some kind of table approach may be considered at some later
> time. But not now ;-)

There is already such table approach implemented in Emacs long ago,
and I think desktop.el should use it instead of handling --no-desktop
in startup.el.

There is a special variable `command-switch-alist' which is intended
exactly for this case, i.e. you could add to desktop.el:

;;;###autoload
(add-hook 'command-switch-alist
          '("--no-desktop" . (lambda (argi) (load "desktop"))))

However, loading desktop.el is not a good solution.  Perhaps better would be:

;;;###autoload
(add-hook 'command-switch-alist
          '("--no-desktop" .
            (lambda (argi)
             (message "\"--no-desktop\" ignored because the Desktop package is 
not loaded"))))

Still not ideal.  Another solution is to add an autoload cookie before
`add-hook' adding a lambda to `after-init-hook' in desktop.el:

;;;###autoload
(add-hook
  'after-init-hook
  '(lambda ()
    (let ((key "--no-desktop"))
      (when (member key command-line-args)
        (setq command-line-args (delete key command-line-args))
        (setq desktop-save-mode nil)))
    (when desktop-save-mode (desktop-read))))

This would work as well.  Or maybe the lambda from `after-init-hook'
should be duplicated in command-switch-alist?

--
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]