From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: --no-desktop broken? Date: Mon, 23 Jan 2006 03:51:16 +0200 Organization: JURTA Message-ID: <87mzhnfykz.fsf@jurta.org> References: <1137804521.206430.18968.nullmailer@Update.UU.SE> <43D2012A.8050406@soem.dk> <2E5FEB1A-6442-41BC-BDEC-60A1B45C13E6@raeburn.org> <43D36D66.9010108@soem.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1137985896 32203 80.91.229.2 (23 Jan 2006 03:11:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 23 Jan 2006 03:11:36 +0000 (UTC) Cc: ams@gnu.org, raeburn@raeburn.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 23 04:11:32 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F0s79-0002fB-Ed for ged-emacs-devel@m.gmane.org; Mon, 23 Jan 2006 04:11:31 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F0s9l-0001Jg-QT for ged-emacs-devel@m.gmane.org; Sun, 22 Jan 2006 22:14:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F0s9K-0001FU-TK for emacs-devel@gnu.org; Sun, 22 Jan 2006 22:13:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F0s9I-0001Eq-Og for emacs-devel@gnu.org; Sun, 22 Jan 2006 22:13:45 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F0s9I-0001Eg-KL for emacs-devel@gnu.org; Sun, 22 Jan 2006 22:13:44 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1F0sDx-0005Hp-0V; Sun, 22 Jan 2006 22:18:33 -0500 Original-Received: from mail.neti.ee (80-235-32-219-dsl.mus.estpak.ee [80.235.32.219]) by Relayhost1.neti.ee (Postfix) with ESMTP id ED0096ED4; Mon, 23 Jan 2006 05:10:57 +0200 (EET) Original-To: Lars Hansen In-Reply-To: <43D36D66.9010108@soem.dk> (Lars Hansen's message of "Sun, 22 Jan 2006 12:32:54 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:49431 Archived-At: >> 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/