Re: dired keymap and (vt100) terminal setup hooks

Joerg-Martin Schwarz (UPH508@unidozr.hrz.uni-dortmund.de)
Thu, 17 Mar 94 13:17:33 SET


On Mon, 14 Mar 1994 16:38:17 +0100 sandy said:
>>>>>> On Mon, 14 Mar 94 15:26:21 SET,
>      Joerg-Martin Schwarz <UPH508@unidozr.hrz.uni-dortmund.de> said:
>
> > Calling emacs as 'emacs /anonymous@ftp.germany.eu.net:/pub/'
> > causes the dired have a bad keymap.
> > The key vt100 arrow keys, equivalent to "\M-[", are replaced
> > by dired-prev-subdir.
>
> > [...]
>
>I would argue that when emacs is invoked by giving a file on the
>command line, the term-setup-hook should run before the file is
>actually visited.  Major modes may need to look at the keymap.
>
>In fact, from the emacs 18 lisp manual:
>[...]
>
>However, a quick look in V18 startup.el indicates that the
>term-setup-hook gets run _after_ command line args are processed.  Can
>someone who knows explain why?
>
>--sandy

   Sandy, you don't need to patch dired.el to handle this.
   I guess that this is one of  the  bugs in v18 that have been fixed in
   v19.

   Since ~/.emacs is loaded before the command-line is parsed, one is
   still able to do the patch there.   (I append my ~/.emacs below)

                                      With best regards,
                                      Joerg-Martin Schwarz
/------------------------------+---------------------------------------------\
|Address:                      | e-mail:                                     |
|    Abteilung Physik (T III)  |  uph508@unidozr.hrz.uni-dortmund.de         |
|    Universitaet Dortmund     |  schwarz@{hal1,het}.physik.uni-dortmund.de  |
|    Otto Hahn-Strasse 4       |---------------------------------------------|
|    D44221 Dortmund           |                                             |
|    F R GERMANY               |                                             |
|Telephone:+49/231/755-3581    |      ___                                    |
|Fax:                 -3569    |     (o o)                                   |
\------------------------------+--ooO-(_)-Ooo--------------------------------/

;;;
;;;    Personal Initialization File  for /emacs/bin/emacs
;;;                                        J.-M. Schwarz


;; Terminal arrow keys for VT100
(setq term-setup-hook
      '(lambda ()
         (if (not (fboundp 'enable-arrow-keys))
             nil
           (enable-arrow-keys)
           (global-set-key "\M-[[" 'forward-paragraph)
           (global-set-key "\M-[\M-[" 'forward-paragraph))))

;;[...]

(fset 'command-line-1-orig (symbol-function 'command-line-1))
(defun command-line-1 (args)
  ;;; Call setup hooks before parsing the command line
  (and term-setup-hook
       (funcall term-setup-hook))
  (and window-setup-hook
       (funcall window-setup-hook))
  (setq term-setup-hook nil
        window-setup-hook nil)
  (command-line-1-orig args))