emacs-devel
[Top][All Lists]
Advanced

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

Re: "About Emacs" menu item?


From: Pavel Janík
Subject: Re: "About Emacs" menu item?
Date: Mon, 28 Jan 2002 09:56:24 +0100
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i386-suse-linux-gnu)

   From: Richard Stallman <address@hidden>
   Date: Sun, 27 Jan 2002 11:55:57 -0700 (MST)

   >     What about replacing the menu item "Show Emacs Version" in Help menu 
with
   >     "About Emacs" which will show you the initial splash-screen? You will 
not
   >     loose information, because the output of emacs-version is also part of 
the
   >     splash screen (both of them, fancy and normal) and you will see 
additional
   >     informations.
   > 
   > Sounds good.  Please go ahead.

Menu-bar change is straightforward:

--- menu-bar.el.~1.191.~        Sun Jan 27 14:45:36 2002
+++ menu-bar.el Sun Jan 27 20:32:54 2002
@@ -1040,8 +1040,8 @@
                                               data-directory))
                  (goto-address)))
              :help "Where to find some extra packages and possible updates"))
-(define-key menu-bar-help-menu [emacs-version]
-  '(menu-item "Show Emacs Version" emacs-version))
+(define-key menu-bar-help-menu [about]
+  '(menu-item "About Emacs" display-splash-screen))
 (define-key menu-bar-help-menu [sep2]
   '("--"))
 (define-key menu-bar-help-menu [finder-by-keyword]



I have slightly restructured startup.el to make this easier. Initial
behaviour is the same and the new menu-item works as expected with -nw, but
it does not when in X. In X, it displays fancy splash screens, but you can
not end it with a mouse click. Only keyboard. Also hourglass-cursor is
displayed. It is really strange, because it is not displayed at the start
of Emacs. The value of display-hourglass seems to be "reverse" as
described:

display-hourglass's value is t

Documentation:
*Non-nil means show an hourglass pointer when running under a window system.


But after (setq display-hourglass nil) and one second (the value of
hourglass-delay) the hourglass pointer is displayed. But the docu says it
should be displayed only when display-hourglass is non-nil. Is this a bug?

My current patch for startup.el follows:

--- startup.el.~1.288.~ Fri Jan 25 18:50:37 2002
+++ startup.el  Sun Jan 27 20:30:35 2002
@@ -1287,6 +1287,139 @@
       (> window-height (+ image-height 15)))))
 
 
+(defun normal-splash-screen ()
+  "Display splash screen when Emacs starts."
+  (with-current-buffer (get-buffer-create "GNU Emacs")
+    (let ((tab-width 8)
+         (mode-line-format (propertize "---- %b %-" 
+                                       'face '(:weight bold))))
+
+      ;; The convention for this piece of code is that
+      ;; each piece of output starts with one or two newlines
+      ;; and does not end with any newlines.
+      (insert "Welcome to GNU Emacs")
+      (if (eq system-type 'gnu/linux)
+         (insert ", one component of a Linux-based GNU system."))
+      (insert "\n")
+
+      (unless (equal (buffer-name (current-buffer)) "*scratch*")
+       (insert (substitute-command-keys
+                "\nType \\[recenter] to begin editing your file.\n")))
+
+      (if (display-mouse-p)
+         ;; The user can use the mouse to activate menus
+         ;; so give help in terms of menu items.
+         (progn
+           (insert "\
+You can do basic editing with the menu bar and scroll bar using the mouse.
+
+Useful File menu items:
+Exit Emacs             (or type Control-x followed by Control-c)
+Recover Session                recover files you were editing before a crash
+
+Important Help menu items:
+Emacs Tutorial         Learn-by-doing tutorial for using Emacs efficiently.
+Emacs FAQ              Frequently asked questions and answers
+\(Non)Warranty         GNU Emacs comes with ABSOLUTELY NO WARRANTY
+Copying Conditions     Conditions for redistributing and changing Emacs.
+Getting New Versions   How to obtain the latest version of Emacs.
+Ordering Manuals       How to order manuals from the FSF.
+")
+           (insert "\n\n" (emacs-version)
+                           "
+Copyright (C) 2001 Free Software Foundation, Inc."))
+
+       ;; No mouse menus, so give help using kbd commands.
+
+       ;; If keys have their default meanings,
+       ;; use precomputed string to save lots of time.
+       (if (and (eq (key-binding "\C-h") 'help-command)
+                (eq (key-binding "\C-xu") 'advertised-undo)
+                (eq (key-binding "\C-x\C-c") 'save-buffers-kill-emacs)
+                (eq (key-binding "\C-ht") 'help-with-tutorial)
+                (eq (key-binding "\C-hi") 'info)
+                (eq (key-binding "\C-h\C-n") 'view-emacs-news))
+           (insert "
+Get help          C-h  (Hold down CTRL and press h)
+Undo changes      C-x u       Exit Emacs               C-x C-c
+Get a tutorial    C-h t       Use Info to read docs    C-h i
+Ordering manuals   C-h RET")
+         (insert (substitute-command-keys
+                  (format "\n
+Get help          %s
+Undo changes      \\[advertised-undo]
+Exit Emacs        \\[save-buffers-kill-emacs]
+Get a tutorial    \\[help-with-tutorial]
+Use Info to read docs  \\[info]
+Ordering manuals   \\[view-order-manuals]"
+                          (let ((where (where-is-internal
+                                        'help-command nil t)))
+                            (if where
+                                (key-description where)
+                              "M-x help"))))))
+
+       ;; Say how to use the menu bar with the keyboard.
+       (if (and (eq (key-binding "\M-`") 'tmm-menubar)
+                (eq (key-binding [f10]) 'tmm-menubar))
+           (insert "
+Activate menubar   F10  or  ESC `  or   M-`")
+         (insert (substitute-command-keys "
+Activate menubar     \\[tmm-menubar]")))
+
+       ;; Many users seem to have problems with these.
+       (insert "
+\(`C-' means use the CTRL key.  `M-' means use the Meta (or Alt) key.
+If you have no Meta key, you may instead type ESC followed by the character.)")
+
+       (insert "\n\n" (emacs-version)
+                       "
+Copyright (C) 2001 Free Software Foundation, Inc.")
+
+       (if (and (eq (key-binding "\C-h\C-c") 'describe-copying)
+                (eq (key-binding "\C-h\C-d") 'describe-distribution)
+                (eq (key-binding "\C-h\C-w") 'describe-no-warranty))
+           (insert 
+                    "\n
+GNU Emacs comes with ABSOLUTELY NO WARRANTY; type C-h C-w for full details.
+Emacs is Free Software--Free as in Freedom--so you can redistribute copies
+of Emacs and modify it; type C-h C-c to see the conditions.
+Type C-h C-d for information on getting the latest version.")
+         (insert (substitute-command-keys
+                  "\n
+GNU Emacs comes with ABSOLUTELY NO WARRANTY; type \\[describe-no-warranty] for 
full details.
+Emacs is Free Software--Free as in Freedom--so you can redistribute copies
+of Emacs and modify it; type \\[describe-copying] to see the conditions.
+Type \\[describe-distribution] for information on getting the latest 
version."))))
+
+      ;; The rest of the startup screen is the same on all
+      ;; kinds of terminals.
+
+      ;; Give information on recovering, if there was a crash.
+      (and auto-save-list-file-prefix
+          ;; Don't signal an error if the
+          ;; directory for auto-save-list files
+          ;; does not yet exist.
+          (file-directory-p (file-name-directory
+                             auto-save-list-file-prefix))
+          (directory-files
+           (file-name-directory auto-save-list-file-prefix)
+           nil
+           (concat "\\`"
+                   (regexp-quote (file-name-nondirectory
+                                  auto-save-list-file-prefix)))
+           t)
+          (insert "\n\nIf an Emacs session crashed recently, "
+                  "type M-x recover-session RET\nto recover"
+                  " the files you were editing."))
+
+      ;; Display the input that we set up in the buffer.
+      (set-buffer-modified-p nil)
+      (goto-char (point-min))
+      (save-window-excursion
+       (switch-to-buffer (current-buffer))
+       (sit-for 120))))
+  (kill-buffer "GNU Emacs"))
+
 (defun startup-echo-area-message ()
   (if (eq (key-binding "\C-h\C-p") 'describe-project)
       "For information about the GNU Project and its goals, type C-h C-p."
@@ -1300,6 +1433,17 @@
     (message (startup-echo-area-message))))
 
 
+(defun display-splash-screen ()
+  "Display splash screen according to display.
+Fancy splash screens are used on graphic displays,
+normal otherwise."
+  (interactive)
+  (if (and (display-graphic-p)
+          (use-fancy-splash-screens-p))
+      (fancy-splash-screens)
+    (normal-splash-screen)))
+
+
 (defun command-line-1 (command-line-args-left)
   (or noninteractive (input-pending-p) init-file-had-error
       ;; t if the init file says to inhibit the echo area startup message.
@@ -1572,141 +1716,8 @@
 
     ;; If user typed input during all that work,
     ;; abort the startup screen.  Otherwise, display it now.
-    (let ((buffer (current-buffer)))
-      (when (not (input-pending-p))
-       (if (and (display-graphic-p)
-                (use-fancy-splash-screens-p))
-           (fancy-splash-screens)
-         (with-current-buffer (get-buffer-create "GNU Emacs")
-           (let ((tab-width 8)
-                 (mode-line-format (propertize "---- %b %-" 
-                                               'face '(:weight bold))))
-
-             ;; The convention for this piece of code is that
-             ;; each piece of output starts with one or two newlines
-             ;; and does not end with any newlines.
-             (insert "Welcome to GNU Emacs")
-             (if (eq system-type 'gnu/linux)
-                 (insert ", one component of a Linux-based GNU system."))
-             (insert "\n")
-
-             (unless (equal (buffer-name buffer) "*scratch*")
-               (insert (substitute-command-keys
-                        "\nType \\[recenter] to begin editing your file.\n")))
-
-             (if (display-mouse-p)
-                 ;; The user can use the mouse to activate menus
-                 ;; so give help in terms of menu items.
-                 (progn
-                   (insert "\
-You can do basic editing with the menu bar and scroll bar using the mouse.
-
-Useful File menu items:
-Exit Emacs             (or type Control-x followed by Control-c)
-Recover Session                recover files you were editing before a crash
-
-Important Help menu items:
-Emacs Tutorial         Learn-by-doing tutorial for using Emacs efficiently.
-Emacs FAQ              Frequently asked questions and answers
-\(Non)Warranty         GNU Emacs comes with ABSOLUTELY NO WARRANTY
-Copying Conditions     Conditions for redistributing and changing Emacs.
-Getting New Versions   How to obtain the latest version of Emacs.
-Ordering Manuals       How to order manuals from the FSF.
-")
-                   (insert "\n\n" (emacs-version)
-                           "
-Copyright (C) 2001 Free Software Foundation, Inc."))
-
-               ;; No mouse menus, so give help using kbd commands.
-
-               ;; If keys have their default meanings,
-               ;; use precomputed string to save lots of time.
-               (if (and (eq (key-binding "\C-h") 'help-command)
-                        (eq (key-binding "\C-xu") 'advertised-undo)
-                        (eq (key-binding "\C-x\C-c") 'save-buffers-kill-emacs)
-                        (eq (key-binding "\C-ht") 'help-with-tutorial)
-                        (eq (key-binding "\C-hi") 'info)
-                        (eq (key-binding "\C-h\C-n") 'view-emacs-news))
-                   (insert "
-Get help          C-h  (Hold down CTRL and press h)
-Undo changes      C-x u       Exit Emacs               C-x C-c
-Get a tutorial    C-h t       Use Info to read docs    C-h i
-Ordering manuals   C-h RET")
-                 (insert (substitute-command-keys
-                          (format "\n
-Get help          %s
-Undo changes      \\[advertised-undo]
-Exit Emacs        \\[save-buffers-kill-emacs]
-Get a tutorial    \\[help-with-tutorial]
-Use Info to read docs  \\[info]
-Ordering manuals   \\[view-order-manuals]"
-                                  (let ((where (where-is-internal
-                                                'help-command nil t)))
-                                    (if where
-                                        (key-description where)
-                                      "M-x help"))))))
-
-               ;; Say how to use the menu bar with the keyboard.
-               (if (and (eq (key-binding "\M-`") 'tmm-menubar)
-                        (eq (key-binding [f10]) 'tmm-menubar))
-                   (insert "
-Activate menubar   F10  or  ESC `  or   M-`")
-                 (insert (substitute-command-keys "
-Activate menubar     \\[tmm-menubar]")))
-
-               ;; Many users seem to have problems with these.
-               (insert "
-\(`C-' means use the CTRL key.  `M-' means use the Meta (or Alt) key.
-If you have no Meta key, you may instead type ESC followed by the character.)")
-
-               (insert "\n\n" (emacs-version)
-                       "
-Copyright (C) 2001 Free Software Foundation, Inc.")
-
-               (if (and (eq (key-binding "\C-h\C-c") 'describe-copying)
-                        (eq (key-binding "\C-h\C-d") 'describe-distribution)
-                        (eq (key-binding "\C-h\C-w") 'describe-no-warranty))
-                   (insert 
-                    "\n
-GNU Emacs comes with ABSOLUTELY NO WARRANTY; type C-h C-w for full details.
-Emacs is Free Software--Free as in Freedom--so you can redistribute copies
-of Emacs and modify it; type C-h C-c to see the conditions.
-Type C-h C-d for information on getting the latest version.")
-                 (insert (substitute-command-keys
-                          "\n
-GNU Emacs comes with ABSOLUTELY NO WARRANTY; type \\[describe-no-warranty] for 
full details.
-Emacs is Free Software--Free as in Freedom--so you can redistribute copies
-of Emacs and modify it; type \\[describe-copying] to see the conditions.
-Type \\[describe-distribution] for information on getting the latest 
version."))))
-
-             ;; The rest of the startup screen is the same on all
-             ;; kinds of terminals.
-
-             ;; Give information on recovering, if there was a crash.
-             (and auto-save-list-file-prefix
-                  ;; Don't signal an error if the
-                  ;; directory for auto-save-list files
-                  ;; does not yet exist.
-                  (file-directory-p (file-name-directory
-                                     auto-save-list-file-prefix))
-                  (directory-files
-                   (file-name-directory auto-save-list-file-prefix)
-                   nil
-                   (concat "\\`"
-                           (regexp-quote (file-name-nondirectory
-                                          auto-save-list-file-prefix)))
-                   t)
-                  (insert "\n\nIf an Emacs session crashed recently, "
-                          "type M-x recover-session RET\nto recover"
-                          " the files you were editing."))
-
-             ;; Display the input that we set up in the buffer.
-             (set-buffer-modified-p nil)
-             (goto-char (point-min))
-             (save-window-excursion
-               (switch-to-buffer (current-buffer))
-               (sit-for 120))))
-         (kill-buffer "GNU Emacs"))))))
+    (unless (input-pending-p)
+      (display-splash-screen))))
 
 
 (defun command-line-normalize-file-name (file)

-- 
Pavel Janík

Poetry in patches, indeed.
                  -- Linus Torvalds about Al Viro's patches



reply via email to

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