unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Thomas A. Horsley" <tom.horsley@att.net>
Cc: tom.horsley@ccur.com
Subject: emacs 21.2 patch to allow ~/ suppression in read-file-name
Date: Fri, 6 Sep 2002 01:10:04 +0000	[thread overview]
Message-ID: <20020906011004.VXQX9712.mtiwmhc21.worldnet.att.net@SPIKE.att.net> (raw)

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	other threads:[~2002-09-06  1:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020906011004.VXQX9712.mtiwmhc21.worldnet.att.net@SPIKE.att.net \
    --to=tom.horsley@att.net \
    --cc=tom.horsley@ccur.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).