all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* New $TERM init code
@ 2005-07-29 20:04 Stefan Monnier
  2005-07-29 23:56 ` Dan Nicolaescu
  2005-09-12 15:51 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Monnier @ 2005-07-29 20:04 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-12 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-29 20:04 New $TERM init code Stefan Monnier
2005-07-29 23:56 ` Dan Nicolaescu
2005-09-12 15:51 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.