From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Thomas A. Horsley" Newsgroups: gmane.emacs.bugs Subject: emacs 21.2 patch to allow ~/ suppression in read-file-name Date: Fri, 6 Sep 2002 01:10:04 +0000 Sender: bug-gnu-emacs-admin@gnu.org Message-ID: <20020906011004.VXQX9712.mtiwmhc21.worldnet.att.net@SPIKE.att.net> Reply-To: tom.horsley@att.net NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1031274567 26891 127.0.0.1 (6 Sep 2002 01:09:27 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 6 Sep 2002 01:09:27 +0000 (UTC) Cc: tom.horsley@ccur.com Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17n7ck-0006zb-00 for ; Fri, 06 Sep 2002 03:09:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17n7eN-0002aS-00; Thu, 05 Sep 2002 21:11:07 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17n7dR-0002Xp-00 for bug-gnu-emacs@gnu.org; Thu, 05 Sep 2002 21:10:09 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17n7dO-0002XG-00 for bug-gnu-emacs@gnu.org; Thu, 05 Sep 2002 21:10:08 -0400 Original-Received: from mtiwmhc24.worldnet.att.net ([204.127.131.49] helo=mtiwmhc21.worldnet.att.net) by monty-python.gnu.org with esmtp (Exim 4.10) id 17n7dN-0002XC-00 for bug-gnu-emacs@gnu.org; Thu, 05 Sep 2002 21:10:05 -0400 Original-Received: from SPIKE.att.net ([24.54.160.28]) by mtiwmhc21.worldnet.att.net (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020906011004.VXQX9712.mtiwmhc21.worldnet.att.net@SPIKE.att.net>; Fri, 6 Sep 2002 01:10:04 +0000 Original-To: bug-gnu-emacs@gnu.org Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:3437 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:3437 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 + + * fileio.c : New variable. + (syms_of_fileio): DEFVAR_LISP it. + (Fread_file_name): Check it to decide on ~ substitution. + 2002-03-16 Eli Zaretskii * Version 21.2 released. -- >>==>> The *Best* political site >>==+ email: Tom.Horsley@worldnet.att.net icbm: Delray Beach, FL | Free Software and Politics <<==+