delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/28/20:46:22

To: djgpp AT delorie DOT com
Subject: Re: Minor glich under NT (info)?
References: <7dkgv4$ork$1 AT agate DOT berkeley DOT edu> <20n20y9blc DOT fsf AT Sky DOT inp DOT nsk DOT su> <7dm6d3$s4m$1 AT agate DOT berkeley DOT edu>
From: Michael Bukin <M DOT A DOT Bukin AT inp DOT nsk DOT su>
Date: 29 Mar 1999 08:33:50 +0700
In-Reply-To: chiry@nospam.csua.Berkeley.EDU's message of "28 Mar 1999 21:19:31 GMT"
Message-ID: <20677lhyf5.fsf@Sky.inp.nsk.su>
Lines: 41
X-Mailer: Gnus v5.5/Emacs 19.34
Reply-To: djgpp AT delorie DOT com

chiry AT nospam DOT csua DOT Berkeley DOT EDU writes:

> > (setq Info-suffix-list '((".info.gz" . "gunzip")
> > ...
> 
> Hi Michael, thanks for the reply. Is there a way I can setup my .emacs
> file to append to the list instead of setting it directly? I tried
> add-hook to info-mode, but it doesn't seem to do anything.
> 
> (defun my-info-mode-hook ()
>   (setq Info-suffix-list
> 	(append
> 	 '((".inf" . nil))
> 	 Info-suffix-list)
> 	)
> )
> 
> (add-hook 'info-mode-hook 'my-info-mode-hook)

If I change info-mode-hook to Info-mode-hook, it works for me with
Emacs-20.3.  But it will add one entry in Info-suffix-list each time
you are running info.  It is possible to write the following

(defun append-once (elt list)
  (if (assoc (car elt) list)
      list
    (append (list elt) list)))

(defun my-info-mode-hook ()
  (append-once '(".inf" . nil)
               Info-suffix-list))

(add-hook 'Info-mode-hook 'my-info-mode-hook)

Note that you cannot pass several lists to append-once and expect them
to be appended, you need to add elements by one, or write another
function which accepts any number of lists and concatenates them using
append-once or similar function.

-- 
Michael Bukin

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019