How 'bout the patch below which allows terminal-init-$TERM to be autoloaded
and/or defined elsewhere than in term/$TERM.el (e.g. it can be defined in
~/.emacs, or a single term/foo.el can define both terminal-init-foo-bar and
terminal-init-foo-baz, ...)?


        Stefan


--- orig/lisp/startup.el
+++ mod/lisp/startup.el
@@ -1004,14 +1004,21 @@
                   (not (load (concat term-file-prefix term) t t)))
         ;; Strip off last hyphen and what follows, then try again
         (setq term
-              (if (setq hyphend (string-match "[-_][^-_]+$" term))
+              (if (setq hyphend (string-match "[-_][^-_]+\\'" term))
                   (substring term 0 hyphend)
                 nil)))
-      (when term
+      (setq term (getenv "TERM"))
+      (while term
        ;; The terminal file has been loaded, now call the terminal
        ;; specific initialization function.
        (let ((term-init-func (intern-soft (concat "terminal-init-" term))))
-         (when (fboundp term-init-func)
+         (if (not (fboundp term-init-func))
+              ;; Strip off last hyphen and what follows, then try again
+              (setq term
+                    (if (setq hyphend (string-match "[-_][^-_]+\\'" term))
+                        (substring term 0 hyphend)
+                      nil))
+            (setq term nil)
            (funcall term-init-func))))))
 
   ;; Update the out-of-memory error message based on user's key bindings


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to