From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: New $TERM init code Date: Fri, 29 Jul 2005 16:04:50 -0400 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1122667949 23739 80.91.229.2 (29 Jul 2005 20:12:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Jul 2005 20:12:29 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 29 22:12:27 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DybDC-0002vZ-W3 for ged-emacs-devel@m.gmane.org; Fri, 29 Jul 2005 22:12:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DybFi-0008R1-Nn for ged-emacs-devel@m.gmane.org; Fri, 29 Jul 2005 16:14:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DybFa-0008Qm-Jj for emacs-devel@gnu.org; Fri, 29 Jul 2005 16:14:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DybFW-0008QC-UG for emacs-devel@gnu.org; Fri, 29 Jul 2005 16:14:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dyb8z-0007cd-S8 for emacs-devel@gnu.org; Fri, 29 Jul 2005 16:07:45 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DybHk-0004tS-24 for emacs-devel@gnu.org; Fri, 29 Jul 2005 16:16:48 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 8FFA72CF512; Fri, 29 Jul 2005 16:04:54 -0400 (EDT) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 6B3FA4AC00A; Fri, 29 Jul 2005 16:04:50 -0400 (EDT) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 36589E6C19; Fri, 29 Jul 2005 16:04:50 -0400 (EDT) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.844, requis 5, autolearn=not spam, AWL 0.06, BAYES_00 -4.90) X-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:41321 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41321 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