emacs-devel
[Top][All Lists]
Advanced

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

New $TERM init code


From: Stefan Monnier
Subject: New $TERM init code
Date: Fri, 29 Jul 2005 16:04:50 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

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




reply via email to

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