bug-gnu-emacs
[Top][All Lists]
Advanced

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

emacs 21.2 patch to allow ~/ suppression in read-file-name


From: Thomas A. Horsley
Subject: emacs 21.2 patch to allow ~/ suppression in read-file-name
Date: Fri, 6 Sep 2002 01:10:04 +0000

At long last, I have taken the time to figure out how to add a feature
I have always wanted to emacs: a variable I can set to turn off the
substitution of ~/ for /homedir/ in read-file-name.

Justification for change:

1. I log in to a gazillion different systems and use emacs on all of them.
   I usually can't remember (and certainly never want to remember) what the
   heck ~/ means on whatever system I happen to be on at the moment, so I'd
   rather just see the whole name so I know what emacs is talking about.

2. Everything else in emacs can be customized, why not this too? :-).

I leave it to the emacs Gods to decide if it really belongs in the source.

Note that if default-directory already has ~/ in it, you will still get ~/
in the file name prompt, this just makes it possible to pass an expanded
name as default-directory and not have it get automagically un-expanded.

P.S. In case anyone wants to know why Vread_file_name_suppress_tilde instead
of Qread_file_name_suppress_tilde, I'd first have to have someone explain to
me what the two conventions mean and why I should pick one over the other,
but there doesn't seem to be any emacs internals documentation anywhere that
I can find, so I just cut & pasted until something worked :-).

*** emacs-21.2/src/fileio.c.orig        Thu Sep  5 20:34:33 2002
--- emacs-21.2/src/fileio.c     Thu Sep  5 20:33:24 2002
***************
*** 202,207 ****
--- 202,210 ----
  /* File name in which we write a list of all our auto save files.  */
  Lisp_Object Vauto_save_list_file_name;
  
+ /* Used to suppress ~/ replacement of home directory in read-file-name */
+ Lisp_Object Vread_file_name_suppress_tilde;
+ 
  /* Nonzero means, when reading a filename in the minibuffer,
   start out by inserting the default directory into the minibuffer. */
  int insert_default_directory;
***************
*** 5819,5826 ****
        default_filename = current_buffer->filename;
      }
  
!   /* If dir starts with user's homedir, change that to ~. */
!   homedir = (char *) egetenv ("HOME");
  #ifdef DOS_NT
    /* homedir can be NULL in temacs, since Vprocess_environment is not
       yet set up.  We shouldn't crash in that case.  */
--- 5822,5837 ----
        default_filename = current_buffer->filename;
      }
  
!   /* If dir starts with user's homedir, change that to ~
!      (unless read-file-name-suppress-tilde is true). */
!   if (NILP (Vread_file_name_suppress_tilde))
!     {
!       homedir = (char *) egetenv ("HOME");
!     }
!   else
!     {
!       homedir = 0;
!     }
  #ifdef DOS_NT
    /* homedir can be NULL in temacs, since Vprocess_environment is not
       yet set up.  We shouldn't crash in that case.  */
***************
*** 6196,6201 ****
--- 6207,6217 ----
  shortly after Emacs reads your `.emacs' file, if you have not yet given it\n\
  a non-nil value.");
    Vauto_save_list_file_name = Qnil;
+ 
+   DEFVAR_LISP ("read-file-name-suppress-tilde", 
&Vread_file_name_suppress_tilde,
+     "If t, suppress the substitution of ~/ for home directory name in\n\
+ read-file-name.");
+   Vread_file_name_suppress_tilde = Qnil;
  
    defsubr (&Sfind_file_name_handler);
    defsubr (&Sfile_name_directory);
*** emacs-21.2/src/ChangeLog.orig       Thu Sep  5 20:54:41 2002
--- emacs-21.2/src/ChangeLog    Thu Sep  5 20:58:59 2002
***************
*** 1,3 ****
--- 1,9 ----
+ 2002-09-05  Tom Horsley  <tom.horsley@att.net>
+ 
+       * fileio.c <Vread_file_name_suppress_tilde>: New variable.
+       (syms_of_fileio): DEFVAR_LISP it.
+       (Fread_file_name): Check it to decide on ~ substitution.
+ 
  2002-03-16  Eli Zaretskii  <eliz@is.elta.co.il>
  
        * Version 21.2 released.

--
>>==>> The *Best* political site <URL:http://www.vote-smart.org/> >>==+
      email: Tom.Horsley@worldnet.att.net icbm: Delray Beach, FL      |
<URL:http://home.att.net/~Tom.Horsley> Free Software and Politics <<==+





reply via email to

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