XEmacs 21.2.28 "Hermes".
[chise/xemacs-chise.git.1] / lisp / menubar-items.el
index a096e9d..cab09aa 100644 (file)
                    (or buffer-undo-list pending-undo-list))
        :suffix (if (or (eq last-command 'undo)
                       (eq last-command 'advertised-undo))
-                      "More" "")]
+                  "More" "")]
       ["Redo" redo
        :included (fboundp 'redo)
        :active (not (or (eq buffer-undo-list t)
-                        (eq last-buffer-undo-list nil)
-                        (not (or (eq last-buffer-undo-list buffer-undo-list)
-                                 (and (null (car-safe buffer-undo-list))
-                                      (eq last-buffer-undo-list
-                                          (cdr-safe buffer-undo-list)))))
-                        (or (eq buffer-undo-list pending-undo-list)
-                            (eq (cdr buffer-undo-list) pending-undo-list))))
+                       (eq last-buffer-undo-list nil)
+                       (not (or (eq last-buffer-undo-list buffer-undo-list)
+                                (and (null (car-safe buffer-undo-list))
+                                     (eq last-buffer-undo-list
+                                         (cdr-safe buffer-undo-list)))))
+                       (or (eq buffer-undo-list pending-undo-list)
+                           (eq (cdr buffer-undo-list) pending-undo-list))))
        :suffix (if (eq last-command 'redo) "More" "")]
       ["Cut" kill-primary-selection
        :active (selection-owner-p)]
       ["Show Message Log" show-message-log]
       )
 
-     ,@(if (featurep 'mule)
-          '(("Mule"
-             ("Describe language support")
-             ("Set language environment")
-             "--"
-             ["Toggle input method" toggle-input-method]
-             ["Select input method" select-input-method]
-             ["Describe input method" describe-input-method]
-             "--"
-             ["Describe current coding systems"
-              describe-current-coding-system]
-             ["Set coding system of buffer file"
-              set-buffer-file-coding-system]
-             ;; not implemented yet
-             ["Set coding system of terminal"
-              set-terminal-coding-system :active nil]
-             ;; not implemented yet
-             ["Set coding system of keyboard"
-              set-keyboard-coding-system :active nil]
-             ;; not implemented yet
-             ["Set coding system of process"
-              set-current-process-coding-system :active nil]
-             "--"
-             ["Show character table" view-charset-by-menu]
-             ;; not implemented yet
-             ["Show diagnosis for MULE" mule-diag :active nil]
-             ["Show many languages" view-hello-file])))
+     ,@(when (featurep 'mule)
+        '(("Mule"
+           ("Describe language support")
+           ("Set language environment")
+           "--"
+           ["Toggle input method" toggle-input-method]
+           ["Select input method" set-input-method]
+           ["Describe input method" describe-input-method]
+           "--"
+           ["Describe current coding systems"
+            describe-current-coding-system]
+           ["Set coding system of buffer file"
+            set-buffer-file-coding-system]
+           ;; not implemented yet
+           ["Set coding system of terminal"
+            set-terminal-coding-system :active nil]
+           ;; not implemented yet
+           ["Set coding system of keyboard"
+            set-keyboard-coding-system :active nil]
+           ["Set coding system of process"
+            set-buffer-process-coding-system
+            :active (get-buffer-process (current-buffer))]
+           "--"
+           ["Show character table" view-charset-by-menu]
+           ;; not implemented yet
+           ["Show diagnosis for MULE" mule-diag :active nil]
+           ["Show many languages" view-hello-file])))
 
      ("Apps"
       ["Read Mail (VM)..." vm
        :active (fboundp 'gnus)]
       ["Browse the Web" w3
        :active (fboundp 'w3)]
-      ["Gopher" gopher
-       :active (fboundp 'gopher)]
       "----"
       ["Spell-Check Buffer" ispell-buffer
        :active (fboundp 'ispell-buffer)]
        ["Saved..." customize-saved]
        ["Set..." customize-customized]
        ["Apropos..." customize-apropos]
-       ["Browse..." customize-browse]
-       ["Update Packages" package-get-custom])
+       ["Browse..." customize-browse])
+
+      ("Manage Packages"
+       ("Add Download Site"
+        :filter (lambda (&rest junk)
+                  (package-get-download-menu)))
+       ["Update Package Index" package-get-update-base]
+       ["List & Install" pui-list-packages]
+       ["Update Installed Packages" package-get-update-all]
+       ;; hack-o-matic, we can't force a load of package-base here
+       ;; since it triggers dialog box interactions which we can't
+       ;; deal with while using a menu
+       ("Using Custom" 
+       :filter (lambda (&rest junk)
+                 (if package-get-base
+                     (cdr (custom-menu-create 'packages))
+                   '(["Please load Package Index" (lamda (&rest junk) ()) nil]))))
+       
+       ["Help" (Info-goto-node "(xemacs)Packages")])
+
+      "---"
+
       ("Editing Options"
        ["Overstrike"
        (progn
          (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
          (customize-set-variable 'overwrite-mode overwrite-mode))
        :style toggle :selected overwrite-mode]
-       ["Case Sensitive Search" 
-       (customize-set-variable 'case-fold-search 
+       ["Case Sensitive Search"
+       (customize-set-variable 'case-fold-search
                                (setq case-fold-search (not case-fold-search)))
        :style toggle :selected (not case-fold-search)]
-       ["Case Matching Replace" 
+       ["Case Matching Replace"
        (customize-set-variable 'case-replace (not case-replace))
        :style toggle :selected case-replace]
        ["Auto Delete Selection"
        :style toggle
        :selected (and (boundp 'pending-delete-mode) pending-delete-mode)
        :active (boundp 'pending-delete-mode)]
-       ["Active Regions" 
+       ["Active Regions"
        (customize-set-variable 'zmacs-regions (not zmacs-regions))
        :style toggle :selected zmacs-regions]
-       ["Mouse Paste At Text Cursor" 
+       ["Mouse Paste At Text Cursor"
        (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
        :style toggle :selected mouse-yank-at-point]
        ("Newline at end of file..."
         (customize-set-variable 'require-final-newline 'ask)
         :style radio :selected (and require-final-newline
                                     (not (eq require-final-newline t)))])
-       ["Add Newline When Moving Past End" 
-       (customize-set-variable 'next-line-add-newlines 
+       ["Add Newline When Moving Past End"
+       (customize-set-variable 'next-line-add-newlines
                                (not next-line-add-newlines))
        :style toggle :selected next-line-add-newlines]
        )
       ("General Options"
-       ["Teach Extended Commands" 
+       ["Teach Extended Commands"
        (customize-set-variable 'teach-extended-commands-p
                                (not teach-extended-commands-p))
        :style toggle :selected teach-extended-commands-p]
        ["Debug On Error"
        (customize-set-variable 'debug-on-error (not debug-on-error))
        :style toggle :selected debug-on-error]
-       ["Debug On Quit" 
+       ["Debug On Quit"
        (customize-set-variable 'debug-on-quit (not debug-on-quit))
        :style toggle :selected debug-on-quit]
        )
         :style radio
         :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement))
         :active (boundp 'ps-paper-type)]
-       ["Executive" 
+       ["Executive"
         (customize-set-variable 'ps-paper-type 'executive)
         :style radio
         :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive))
         :style radio
         :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid))
         :active (boundp 'ps-paper-type)]
-       ["Ledger" 
+       ["Ledger"
         (customize-set-variable 'ps-paper-type 'ledger)
         :style radio
         :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger))
         :style radio
         :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3))
         :active (boundp 'ps-paper-type)]
-       ["A4" 
+       ["A4"
         (customize-set-variable 'ps-paper-type 'a4)
         :style radio
         :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4))
         :active (boundp 'ps-paper-type)]
-       ["A4small" 
+       ["A4small"
         (customize-set-variable 'ps-paper-type 'a4small)
         :style radio
         :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small))
         :active (boundp 'ps-paper-type)]
-       ["B4" 
+       ["B4"
         (customize-set-variable 'ps-paper-type 'b4)
         :style radio
         :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4))
         :active (boundp 'ps-paper-type)]
-       ["B5" 
+       ["B5"
         (customize-set-variable 'ps-paper-type 'b5)
         :style radio
         :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5))
        ["Color Printing"
        (cond (ps-print-color-p
               (customize-set-variable 'ps-print-color-p nil)
-              ;; I'm wondering whether all this muck is usefull.
+              ;; I'm wondering whether all this muck is useful.
               (and (boundp 'original-face-background)
                    original-face-background
                    (set-face-background 'default original-face-background)))
              (t
               (customize-set-variable 'ps-print-color-p t)
-              (setq original-face-background 
+              (setq original-face-background
                     (face-background-instance 'default))
               (set-face-background 'default "white")))
-       :style toggle 
+       :style toggle
        :selected (and (boundp 'ps-print-color-p) ps-print-color-p)
        :active (boundp 'ps-print-color-p)])
       ("\"Other Window\" Location"
        ["Always in Same Frame"
-       (customize-set-variable 
+       (customize-set-variable
         'get-frame-for-buffer-default-instance-limit nil)
        :style radio
        :selected (null get-frame-for-buffer-default-instance-limit)]
        :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
        "-----"
        ["Temp Buffers Always in Same Frame"
-       (customize-set-variable 'temp-buffer-show-function 
+       (customize-set-variable 'temp-buffer-show-function
                                'show-temp-buffer-in-current-frame)
        :style radio
        :selected (eq temp-buffer-show-function
        )
       "-----"
       ("Syntax Highlighting"
-       ["In This Buffer" 
+       ["In This Buffer"
        (progn ;; becomes buffer local
          (font-lock-mode)
          (customize-set-variable 'font-lock-mode font-lock-mode))
-       :style toggle 
+       :style toggle
        :selected (and (boundp 'font-lock-mode) font-lock-mode)
        :active (boundp 'font-lock-mode)]
        ["Automatic"
        :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
        :active (fboundp 'font-lock-mode)]
        "-----"
-       ["Fonts" 
+       ["Fonts"
        (progn
          (require 'font-lock)
          (font-lock-use-default-fonts)
                                (not (eq t font-lock-maximum-decoration)))
                           (and (integerp font-lock-maximum-decoration)
                                (<= font-lock-maximum-decoration 0))))]
-       ["More" 
+       ["More"
        (progn
          (require 'font-lock)
          (if (and (integerp font-lock-maximum-decoration)
        :selected (and (boundp 'font-lock-maximium-decoration)
                       (integerp font-lock-maximum-decoration)
                       (= 1 font-lock-maximum-decoration))]
-       ["Even More" 
+       ["Even More"
        (progn
          (require 'font-lock)
          (if (and (integerp font-lock-maximum-decoration)
          ;; be a redisplay bug lurking somewhere (or
          ;; possibly another event handler bug)
          (redraw-modeline))
-       :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode) 
+       :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode)
                     font-lock-mode)
        :style toggle
        :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)]
       ("Paren Highlighting"
        ["None"
        (customize-set-variable 'paren-mode nil)
-       :style radio 
+       :style radio
        :selected (and (boundp 'paren-mode) (not paren-mode))
        :active (boundp 'paren-mode)]
        ["Blinking Paren"
        :active (boundp 'paren-mode)]
        ["Steady Paren"
        (customize-set-variable 'paren-mode 'paren)
-       :style radio 
+       :style radio
        :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
        :active (boundp 'paren-mode)]
        ["Expression"
        (customize-set-variable 'paren-mode 'sexp)
-       :style radio 
+       :style radio
        :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
        :active (boundp 'paren-mode)]
-;;      ["Nested Shading"           
+;;      ["Nested Shading"
 ;;       (customize-set-variable 'paren-mode 'nested)
-;;       :style radio               
+;;       :style radio
 ;;       :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
 ;;       :active (boundp 'paren-mode)]
        )
       "-----"
       ("Frame Appearance"
-       ["Frame-Local Font Menu" 
+       ["Frame-Local Font Menu"
        (customize-set-variable 'font-menu-this-frame-only-p
                                (not font-menu-this-frame-only-p))
-       :style toggle 
+       :style toggle
        :selected (and (boundp 'font-menu-this-frame-only-p)
                       font-menu-this-frame-only-p)]
        ,@(if (featurep 'scrollbar)
             '(["Scrollbars"
                (customize-set-variable 'scrollbars-visible-p
                                        (not scrollbars-visible-p))
-               :style toggle 
+               :style toggle
                :selected scrollbars-visible-p]))
        ;; I don't think this is of any interest. - dverna apr. 98
        ;; #### I beg to differ!  Many FSFmacs converts hate the 3D
        ;; off through the Options menu.  I would have uncommented this
        ;; source, but the code for saving options would not save the
        ;; modeline 3D-ness.  Grrr.  --hniksic
-;;      ["3D Modeline"                    
-;;       (progn                                   
+;;      ["3D Modeline"
+;;       (progn
 ;;         (if (zerop (specifier-instance modeline-shadow-thickness))
 ;;             (set-specifier modeline-shadow-thickness 2)
 ;;           (set-specifier modeline-shadow-thickness 0))
-;;         (redraw-modeline t))                   
-;;       :style toggle                    
-;;       :selected (let ((thickness       
+;;         (redraw-modeline t))
+;;       :style toggle
+;;       :selected (let ((thickness
 ;;                        (specifier-instance modeline-shadow-thickness)))
 ;;                   (and (integerp thickness)
 ;;                        (> thickness 0)))]
        :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
        :active (boundp 'blink-cursor-mode)]
        "-----"
-       ["Block cursor" 
+       ["Block cursor"
        (progn
          (customize-set-variable 'bar-cursor nil)
          (force-cursor-redisplay))
        :style radio
        :selected (null bar-cursor)]
-       ["Bar cursor (1 pixel)" 
+       ["Bar cursor (1 pixel)"
        (progn
          (customize-set-variable 'bar-cursor t)
          (force-cursor-redisplay))
        :style radio
        :selected (eq bar-cursor t)]
-       ["Bar cursor (2 pixels)" 
-        (progn
-          (customize-set-variable 'bar-cursor 2)
-          (force-cursor-redisplay))
-        :style radio 
-        :selected (and bar-cursor (not (eq bar-cursor t)))]
-       "------"
-       ["Line Numbers"
-        (progn
-          (customize-set-variable 'line-number-mode (not line-number-mode))
-          (redraw-modeline))
-        :style toggle :selected line-number-mode]
-       ["Column Numbers"
-        (progn
-          (customize-set-variable 'column-number-mode
-                                  (not column-number-mode))
-          (redraw-modeline))
-        :style toggle :selected column-number-mode]
+       ["Bar cursor (2 pixels)"
+       (progn
+         (customize-set-variable 'bar-cursor 2)
+         (force-cursor-redisplay))
+       :style radio
+       :selected (and bar-cursor (not (eq bar-cursor t)))]
+       "------"
+       ["Line Numbers"
+       (progn
+         (customize-set-variable 'line-number-mode (not line-number-mode))
+         (redraw-modeline))
+       :style toggle :selected line-number-mode]
+       ["Column Numbers"
+       (progn
+         (customize-set-variable 'column-number-mode
+                                 (not column-number-mode))
+         (redraw-modeline))
+       :style toggle :selected column-number-mode]
        )
       ("Menubar Appearance"
        ["Buffers Menu Length..."
        (customize-set-variable
         'buffers-menu-max-size
         ;; would it be better to open a customization buffer ?
-        (let ((val 
+        (let ((val
                (read-number
                 "Enter number of buffers to display (or 0 for unlimited): ")))
           (if (eq val 0) nil val)))]
                       buffers-menu-sort-function)]
        ["By Major Mode, Then Alphabetically"
         (progn
-          (customize-set-variable 
+          (customize-set-variable
            'buffers-menu-sort-function
            'sort-buffers-menu-by-mode-then-alphabetically)
-          (customize-set-variable 
+          (customize-set-variable
            'buffers-menu-grouping-function
            'group-buffers-menu-by-mode-then-alphabetically))
         :style radio
        ["Ignore Scaled Fonts"
        (customize-set-variable 'font-menu-ignore-scaled-fonts
                                (not font-menu-ignore-scaled-fonts))
-       :style toggle 
+       :style toggle
        :selected (and (boundp 'font-menu-ignore-scaled-fonts)
                       font-menu-ignore-scaled-fonts)]
        )
       ,@(if (featurep 'toolbar)
            '(("Toolbar Appearance"
-              ["Visible" 
+              ["Visible"
                (customize-set-variable 'toolbar-visible-p
                                        (not toolbar-visible-p))
                :style toggle
                :selected toolbar-visible-p]
-              ["Captioned" 
+              ["Captioned"
                (customize-set-variable 'toolbar-captioned-p
                                        (not toolbar-captioned-p))
                :style toggle
               ("Default Location"
                ["Top"
                 (customize-set-variable 'default-toolbar-position 'top)
-                :style radio 
+                :style radio
                 :selected (eq default-toolbar-position 'top)]
-               ["Bottom" 
+               ["Bottom"
                 (customize-set-variable 'default-toolbar-position 'bottom)
                 :style radio
                 :selected (eq default-toolbar-position 'bottom)]
                 :selected (eq default-toolbar-position 'right)]
                )
               )))
+      ,@(if (featurep 'gutter)
+           '(("Gutter Appearance"
+              ["Visible"
+               (customize-set-variable 'gutter-visible-p
+                                       (not gutter-visible-p))
+               :style toggle
+               :selected gutter-visible-p]
+              ("Default Location"
+               ["Top"
+                (customize-set-variable 'default-gutter-position 'top)
+                :style radio
+                :selected (eq default-gutter-position 'top)]
+               ["Bottom"
+                (customize-set-variable 'default-gutter-position 'bottom)
+                :style radio
+                :selected (eq default-gutter-position 'bottom)]
+               ["Left"
+                (customize-set-variable 'default-gutter-position 'left)
+                :style radio
+                :selected (eq default-gutter-position 'left)]
+               ["Right"
+                (customize-set-variable 'default-gutter-position 'right)
+                :style radio
+                :selected (eq default-gutter-position 'right)]
+               )
+              )))
       ("Mouse"
        ["Avoid Text..."
-       (customize-set-variable 'mouse-avoidance-mode 
+       (customize-set-variable 'mouse-avoidance-mode
                                (if mouse-avoidance-mode nil 'banish))
        :style toggle
        :selected (and (boundp 'mouse-avoidance-mode) mouse-avoidance-mode)
                     (device-on-window-system-p))]
        )
       ("Open URLs With"
-       ["Emacs-W3" 
+       ["Emacs-W3"
        (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
        :style radio
        :selected (and (boundp 'browse-url-browser-function)
        :active (and (boundp 'browse-url-browser-function)
                     (fboundp 'browse-url-w3)
                     (fboundp 'w3-fetch))]
-       ["Netscape" 
-       (customize-set-variable 'browse-url-browser-function 
+       ["Netscape"
+       (customize-set-variable 'browse-url-browser-function
                                'browse-url-netscape)
        :style radio
        :selected (and (boundp 'browse-url-browser-function)
                       (eq browse-url-browser-function 'browse-url-netscape))
        :active (and (boundp 'browse-url-browser-function)
                     (fboundp 'browse-url-netscape))]
-       ["Mosaic" 
+       ["Mosaic"
        (customize-set-variable 'browse-url-browser-function
                                'browse-url-mosaic)
        :style radio
                       (eq browse-url-browser-function 'browse-url-mosaic))
        :active (and (boundp 'browse-url-browser-function)
                     (fboundp 'browse-url-mosaic))]
-       ["Mosaic (CCI)" 
+       ["Mosaic (CCI)"
        (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
        :style radio
        :selected (and (boundp 'browse-url-browser-function)
                       (eq browse-url-browser-function 'browse-url-cci))
        :active (and (boundp 'browse-url-browser-function)
                     (fboundp 'browse-url-cci))]
-       ["IXI Mosaic" 
-       (customize-set-variable 'browse-url-browser-function 
+       ["IXI Mosaic"
+       (customize-set-variable 'browse-url-browser-function
                                'browse-url-iximosaic)
        :style radio
        :selected (and (boundp 'browse-url-browser-function)
                       (eq browse-url-browser-function 'browse-url-iximosaic))
        :active (and (boundp 'browse-url-browser-function)
                     (fboundp 'browse-url-iximosaic))]
-       ["Lynx (xterm)" 
+       ["Lynx (xterm)"
        (customize-set-variable 'browse-url-browser-function
                                'browse-url-lynx-xterm)
        :style radio
                       (eq browse-url-browser-function 'browse-url-lynx-emacs))
        :active (and (boundp 'browse-url-browser-function)
                     (fboundp 'browse-url-lynx-emacs))]
-       ["Grail" 
+       ["Grail"
        (customize-set-variable 'browse-url-browser-function
                                'browse-url-grail)
        :style radio
                       (eq browse-url-browser-function 'browse-url-grail))
        :active (and (boundp 'browse-url-browser-function)
                     (fboundp 'browse-url-grail))]
+       ["Kfm" 
+       (customize-set-variable 'browse-url-browser-function
+                               'browse-url-kfm)
+       :style radio
+       :selected (and (boundp 'browse-url-browser-function)
+                      (eq browse-url-browser-function 'browse-url-kfm))
+       :active (and (boundp 'browse-url-browser-function)
+                    (fboundp 'browse-url-kfm))]
        )
       "-----"
-      ["Browse Faces..." (customize-face nil)]
+      ["Edit Faces..." (customize-face nil)]
       ("Font"   :filter font-menu-family-constructor)
       ("Size"  :filter font-menu-size-constructor)
-      ("Weight"        :filter font-menu-weight-constructor)
+;      ("Weight"       :filter font-menu-weight-constructor)
       "-----"
       ["Save Options" customize-save-customized]
       )
        ["No Warranty" describe-no-warranty]
        ["XEmacs License" describe-copying]
        ["The Latest Version" describe-distribution])
-      ["Send Bug Report..." report-emacs-bug]))))
+      ["Send Bug Report..." report-emacs-bug
+       :active (fboundp 'report-emacs-bug)]))))
 
 \f
 (defun maybe-add-init-button ()
 Adds `Load .emacs' button to menubar when starting up with -q."
   ;; by Stig@hackvan.com
   (cond
-   (init-file-user nil)
+   (load-user-init-file-p nil)
    ((file-exists-p (expand-file-name ".emacs" "~"))
     (add-menu-button nil
                     ["Load .emacs"
                      (progn (delete-menu-item '("Load .emacs"))
-                            (load-user-init-file (user-login-name)))
+                            (load-user-init-file))
                      ]
                     "Help"))
    (t nil)))
@@ -1055,7 +1108,7 @@ returns a whole bunch of info about a buffer."
   'sort-buffers-menu-by-mode-then-alphabetically
   "*If non-nil, a function to sort the list of buffers in the buffers menu.
 It will be passed two arguments (two buffers to compare) and should return
-T if the first is \"less\" than the second.  One possible value is
+t if the first is \"less\" than the second.  One possible value is
 `sort-buffers-menu-alphabetically'; another is
 `sort-buffers-menu-by-mode-then-alphabetically'."
   :type '(choice (const :tag "None" nil)
@@ -1089,11 +1142,16 @@ Sorts the buffers in alphabetical order by name, but puts buffers beginning
 with a star at the end of the list."
   (let* ((nam1 (buffer-name buf1))
         (nam2 (buffer-name buf2))
+        (inv1p (not (null (string-match "\\` " nam1))))
+        (inv2p (not (null (string-match "\\` " nam2))))
         (star1p (not (null (string-match "\\`*" nam1))))
         (star2p (not (null (string-match "\\`*" nam2)))))
-    (if (not (eq star1p star2p))
-       (not star1p)
-      (string-lessp nam1 nam2))))
+    (cond ((not (eq inv1p inv2p))
+          (not inv1p))
+         ((not (eq star1p star2p))
+          (not star1p))
+         (t
+          (string-lessp nam1 nam2)))))
 
 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
   "For use as a value of `buffers-menu-sort-function'.
@@ -1101,15 +1159,23 @@ Sorts first by major mode and then alphabetically by name, but puts buffers
 beginning with a star at the end of the list."
   (let* ((nam1 (buffer-name buf1))
         (nam2 (buffer-name buf2))
+        (inv1p (not (null (string-match "\\` " nam1))))
+        (inv2p (not (null (string-match "\\` " nam2))))
         (star1p (not (null (string-match "\\`*" nam1))))
         (star2p (not (null (string-match "\\`*" nam2))))
         (mode1 (symbol-value-in-buffer 'major-mode buf1))
         (mode2 (symbol-value-in-buffer 'major-mode buf2)))
-    (cond ((not (eq star1p star2p)) (not star1p))
+    (cond ((not (eq inv1p inv2p))
+          (not inv1p))
+         ((not (eq star1p star2p))
+          (not star1p))
          ((and star1p star2p (string-lessp nam1 nam2)))
-         ((string-lessp mode1 mode2) t)
-         ((string-lessp mode2 mode1) nil)
-         (t (string-lessp nam1 nam2)))))
+         ((string-lessp mode1 mode2)
+          t)
+         ((string-lessp mode2 mode1)
+          nil)
+         (t
+          (string-lessp nam1 nam2)))))
 
 ;; this version is too slow on some machines.
 (defun slow-format-buffers-menu-line (buffer)
@@ -1186,10 +1252,10 @@ This groups buffers by major mode.  It only really makes sense if
                                   (list 'buffer-menu-write-file name) t)
                           (vector "Delete Buffer" (list 'kill-buffer name)
                                   t)))
-            ;; ### We don't want buffer names to be translated,
-            ;; ### so we put the buffer name in the suffix.
-            ;; ### Also, avoid losing with non-ASCII buffer names.
-            ;; ### We still lose, however, if complex-buffers-menu-p. --mrb
+            ;; #### We don't want buffer names to be translated,
+            ;; #### so we put the buffer name in the suffix.
+            ;; #### Also, avoid losing with non-ASCII buffer names.
+            ;; #### We still lose, however, if complex-buffers-menu-p. --mrb
             (vector ""
                     (list buffers-menu-switch-to-buffer-function
                           (buffer-name buffer))
@@ -1350,7 +1416,7 @@ See the function `popup-menu' for a description of menu syntax.")
 (make-variable-buffer-local 'mode-popup-menu)
 
 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
-;; superceded by any local popup menu...
+;; superseded by any local popup menu...
 (setq-default mode-popup-menu default-popup-menu)
 
 (defvar activate-popup-menu-hook nil
@@ -1471,10 +1537,18 @@ The menu is computed by combining `global-popup-menu' and `mode-popup-menu'."
 (defun xemacs-splash-buffer ()
   "Redisplay XEmacs splash screen in a buffer."
   (interactive)
-  (let ((buffer (get-buffer-create "*Splash*")))
+  (let ((buffer (get-buffer-create "*Splash*"))
+       tmout)
     (set-buffer buffer)
+    (setq buffer-read-only t)
     (erase-buffer buffer)
-    (startup-splash-frame)
+    (setq tmout (display-splash-frame))
+    (when tmout
+      (make-local-hook 'kill-buffer-hook)
+      (add-hook 'kill-buffer-hook
+               `(lambda ()
+                  (disable-timeout ,tmout))
+               nil t))
     (pop-to-buffer buffer)
     (delete-other-windows)))
 
@@ -1483,4 +1557,4 @@ The menu is computed by combining `global-popup-menu' and `mode-popup-menu'."
 (provide 'x-menubar)
 (provide 'menubar-items)
 
-;;; x-menubar.el ends here.
+;;; menubar-items.el ends here.