* bug#26272: default-directory: Remark that it must be a directory name @ 2017-03-27 10:13 Tino Calancha 2017-03-27 14:43 ` Eli Zaretskii 0 siblings, 1 reply; 13+ messages in thread From: Tino Calancha @ 2017-03-27 10:13 UTC (permalink / raw) To: 26272 The docstring of `file-name-as-directory' suggests that is important that `default-directory' be a directory name, i.e., for instance in GNU/Linux ends with '/'. The docstring of `default-directory' doesn't mention it. --8<-----------------------------cut here---------------start------------->8--- From 1579eeb2388d65c4fe65fb37e4e5abe373de69e3 Mon Sep 17 00:00:00 2001 From: Tino Calancha <tino.calancha@gmail.com> Date: Mon, 27 Mar 2017 19:04:29 +0900 Subject: [PATCH] default-directory: Remark that it must be a directory name * src/buffer.c (default-directory): Update docstring. --- src/buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/buffer.c b/src/buffer.c index c1c53dd220..f0c334f08b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5754,7 +5754,10 @@ visual lines rather than logical lines. See the documentation of DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), Qstringp, doc: /* Name of default directory of current buffer. -To interactively change the default directory, use command `cd'. */); +It must be a directory name, as the output of `file-name-as-directory'. +To interactively change the default directory, use command `cd'. +In a Elisp program is better to do +(setq default-directory (file-name-as-directory DIR)) */); DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), Qnil, -- 2.11.0 --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 25.2.4 (x86_64-pc-linux-gnu, GTK+ Version 3.22.9) of 2017-03-27 Repository revision: fb18bff91f01a3051253319e766ca276e5b756bd ^ permalink raw reply related [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-27 10:13 bug#26272: default-directory: Remark that it must be a directory name Tino Calancha @ 2017-03-27 14:43 ` Eli Zaretskii 2017-03-27 15:15 ` Tino Calancha 2017-03-31 8:25 ` Tino Calancha 0 siblings, 2 replies; 13+ messages in thread From: Eli Zaretskii @ 2017-03-27 14:43 UTC (permalink / raw) To: Tino Calancha; +Cc: 26272 > From: Tino Calancha <tino.calancha@gmail.com> > Date: Mon, 27 Mar 2017 19:13:05 +0900 > > > The docstring of `file-name-as-directory' suggests that is > important that `default-directory' be a directory name, i.e., > for instance in GNU/Linux ends with '/'. The docstring of > `default-directory' doesn't mention it. Didn't we discuss that at some point in the past? > DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), > Qstringp, > doc: /* Name of default directory of current buffer. > -To interactively change the default directory, use command `cd'. */); > +It must be a directory name, as the output of `file-name-as-directory'. > +To interactively change the default directory, use command `cd'. > +In a Elisp program is better to do > +(setq default-directory (file-name-as-directory DIR)) */); A word of advice for the future: it is usually best to start from informal text that describes well what you mean in your own words, and then "formalize" it as needed, taking care not to lose key words and concepts. If you compare your informal description above with the patched doc string, I think you will agree with me that the former says what you mean in a much more clear and concise way. So something important got lost in transition, and you tried to make up for that by adding more explanations and an example. Here's my suggestion: It should be a directory name (as opposed to a directory file-name). On GNU and Unix systems, directory names and in a slash `/'. This basically says what your original description said, which is spot on. Thanks. ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-27 14:43 ` Eli Zaretskii @ 2017-03-27 15:15 ` Tino Calancha 2017-03-27 15:32 ` Eli Zaretskii 2017-03-31 8:25 ` Tino Calancha 1 sibling, 1 reply; 13+ messages in thread From: Tino Calancha @ 2017-03-27 15:15 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 26272, tino.calancha Eli Zaretskii <eliz@gnu.org> writes: >> From: Tino Calancha <tino.calancha@gmail.com> >> Date: Mon, 27 Mar 2017 19:13:05 +0900 >> >> >> The docstring of `file-name-as-directory' suggests that is >> important that `default-directory' be a directory name, i.e., >> for instance in GNU/Linux ends with '/'. The docstring of >> `default-directory' doesn't mention it. > > Didn't we discuss that at some point in the past? I don't remember it. Maybe with another person. >> DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), >> Qstringp, >> doc: /* Name of default directory of current buffer. >> -To interactively change the default directory, use command `cd'. */); >> +It must be a directory name, as the output of `file-name-as-directory'. >> +To interactively change the default directory, use command `cd'. >> +In a Elisp program is better to do >> +(setq default-directory (file-name-as-directory DIR)) */); > > A word of advice for the future: it is usually best to start from > informal text that describes well what you mean in your own words, and > then "formalize" it as needed, taking care not to lose key words and > concepts. Thanks for the advice. It's a useful one. >If you compare your informal description above with the > patched doc string, I think you will agree with me that the former > says what you mean in a much more clear and concise way. I agree. > Here's my suggestion: > > It should be a directory name (as opposed to a directory file-name). > On GNU and Unix systems, directory names and in a slash `/'. > > This basically says what your original description said, which is spot > on. Much clear. Updated the patch with yout suggestion. I have changed 'and in a slash' with 'end in a slash'. --8<-----------------------------cut here---------------start------------->8--- From e63611ca54a59d8cff18de5ad1413f9678f3a51c Mon Sep 17 00:00:00 2001 From: Tino Calancha <tino.calancha@gmail.com> Date: Tue, 28 Mar 2017 00:07:35 +0900 Subject: [PATCH] default-directory: Remark that it must be a directory name * src/buffer.c (default-directory): Update docstring (Bug#26272). --- src/buffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/buffer.c b/src/buffer.c index c1c53dd220..8ef27dee0f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5754,7 +5754,9 @@ visual lines rather than logical lines. See the documentation of DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), Qstringp, doc: /* Name of default directory of current buffer. -To interactively change the default directory, use command `cd'. */); +It should be a directory name (as opposed to a directory file-name). +On GNU and Unix systems, directory names end in a slash `/'. +To interactively change the default directory, use command `cd'. */); DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), Qnil, -- 2.11.0 --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 25.2.5 (x86_64-pc-linux-gnu, GTK+ Version 3.22.9) of 2017-03-27 Repository revision: fb18bff91f01a3051253319e766ca276e5b756bd ^ permalink raw reply related [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-27 15:15 ` Tino Calancha @ 2017-03-27 15:32 ` Eli Zaretskii 2017-03-27 15:52 ` Noam Postavsky 0 siblings, 1 reply; 13+ messages in thread From: Eli Zaretskii @ 2017-03-27 15:32 UTC (permalink / raw) To: Tino Calancha; +Cc: 26272, tino.calancha > From: Tino Calancha <tino.calancha@gmail.com> > Cc: 26272@debbugs.gnu.org, tino.calancha@gmail.com > Date: Tue, 28 Mar 2017 00:15:07 +0900 > > Eli Zaretskii <eliz@gnu.org> writes: > > >> From: Tino Calancha <tino.calancha@gmail.com> > >> Date: Mon, 27 Mar 2017 19:13:05 +0900 > >> > >> > >> The docstring of `file-name-as-directory' suggests that is > >> important that `default-directory' be a directory name, i.e., > >> for instance in GNU/Linux ends with '/'. The docstring of > >> `default-directory' doesn't mention it. > > > > Didn't we discuss that at some point in the past? > I don't remember it. Maybe with another person. No, I meant on emacs-devel, not with you personally. > I have changed > 'and in a slash' with 'end in a slash'. Oops ;-) ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-27 15:32 ` Eli Zaretskii @ 2017-03-27 15:52 ` Noam Postavsky 2017-03-27 18:26 ` Eli Zaretskii 0 siblings, 1 reply; 13+ messages in thread From: Noam Postavsky @ 2017-03-27 15:52 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 26272, Tino Calancha On Mon, Mar 27, 2017 at 11:32 AM, Eli Zaretskii <eliz@gnu.org> wrote: >> >> The docstring of `file-name-as-directory' suggests that is >> >> important that `default-directory' be a directory name, i.e., >> >> for instance in GNU/Linux ends with '/'. The docstring of >> >> `default-directory' doesn't mention it. >> > >> > Didn't we discuss that at some point in the past? >> I don't remember it. Maybe with another person. > > No, I meant on emacs-devel, not with you personally. This one maybe? (it's about load-path though) https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02060.html ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-27 15:52 ` Noam Postavsky @ 2017-03-27 18:26 ` Eli Zaretskii 2017-03-27 19:23 ` Noam Postavsky 0 siblings, 1 reply; 13+ messages in thread From: Eli Zaretskii @ 2017-03-27 18:26 UTC (permalink / raw) To: Noam Postavsky; +Cc: 26272, tino.calancha > From: Noam Postavsky <npostavs@users.sourceforge.net> > Date: Mon, 27 Mar 2017 11:52:21 -0400 > Cc: Tino Calancha <tino.calancha@gmail.com>, 26272@debbugs.gnu.org > > >> > Didn't we discuss that at some point in the past? > >> I don't remember it. Maybe with another person. > > > > No, I meant on emacs-devel, not with you personally. > > This one maybe? (it's about load-path though) > https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02060.html Yes, but AFAIR it also touched default-directory. ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-27 18:26 ` Eli Zaretskii @ 2017-03-27 19:23 ` Noam Postavsky 2017-03-28 1:54 ` Tino Calancha 0 siblings, 1 reply; 13+ messages in thread From: Noam Postavsky @ 2017-03-27 19:23 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 26272, Tino Calancha On Mon, Mar 27, 2017 at 2:26 PM, Eli Zaretskii <eliz@gnu.org> wrote: >> From: Noam Postavsky <npostavs@users.sourceforge.net> >> Date: Mon, 27 Mar 2017 11:52:21 -0400 >> Cc: Tino Calancha <tino.calancha@gmail.com>, 26272@debbugs.gnu.org >> >> >> > Didn't we discuss that at some point in the past? >> >> I don't remember it. Maybe with another person. >> > >> > No, I meant on emacs-devel, not with you personally. >> >> This one maybe? (it's about load-path though) >> https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02060.html > > Yes, but AFAIR it also touched default-directory. Ah, it seems that code was fixed to be more tolerant: the trailing slash in default-directory used to matter for executing processes, but not any more: https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02367.html (the rest of the discussion seems to mostly just go in circles) ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-27 19:23 ` Noam Postavsky @ 2017-03-28 1:54 ` Tino Calancha 2017-03-28 2:32 ` Eli Zaretskii 0 siblings, 1 reply; 13+ messages in thread From: Tino Calancha @ 2017-03-28 1:54 UTC (permalink / raw) To: Noam Postavsky; +Cc: 26272, Tino Calancha On Mon, 27 Mar 2017, Noam Postavsky wrote: > On Mon, Mar 27, 2017 at 2:26 PM, Eli Zaretskii <eliz@gnu.org> wrote: >>> From: Noam Postavsky <npostavs@users.sourceforge.net> >>> Date: Mon, 27 Mar 2017 11:52:21 -0400 >>> Cc: Tino Calancha <tino.calancha@gmail.com>, 26272@debbugs.gnu.org >>> >>>>>> Didn't we discuss that at some point in the past? >>>>> I don't remember it. Maybe with another person. >>>> >>>> No, I meant on emacs-devel, not with you personally. >>> >>> This one maybe? (it's about load-path though) >>> https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02060.html >> >> Yes, but AFAIR it also touched default-directory. > > Ah, it seems that code was fixed to be more tolerant: the trailing > slash in default-directory used to matter for executing processes, but > not any more: https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02367.html Following is not the same but slightly related: emacs -Q /tmp I) OK M-x cd RET /tmp/ RET M-: (default-directory) RET => "/tmp/" II) OK M-x cd RET /tmp RET M-: (default-directory) RET => "/tmp/" III) Wrong M-x cd RET /tmp// RET M-: (default-directory) RET => "/" ;; Just an issue on interactive calls, as you can see: M-: (mapcar (lambda (x) (progn (cd x) default-directory)) '("/tmp/" "/tmp" "/tmp//")) RET => ("/tmp/" "/tmp/" "/tmp/") ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-28 1:54 ` Tino Calancha @ 2017-03-28 2:32 ` Eli Zaretskii 2017-03-28 8:33 ` Tino Calancha 0 siblings, 1 reply; 13+ messages in thread From: Eli Zaretskii @ 2017-03-28 2:32 UTC (permalink / raw) To: Tino Calancha; +Cc: 26272, npostavs > From: Tino Calancha <tino.calancha@gmail.com> > Date: Tue, 28 Mar 2017 10:54:36 +0900 (JST) > cc: Eli Zaretskii <eliz@gnu.org>, Tino Calancha <tino.calancha@gmail.com>, > 26272@debbugs.gnu.org > > III) Wrong > M-x cd RET /tmp// RET > M-: (default-directory) RET > => "/" Why is this wrong? It's a standard Emacs feature. ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-28 2:32 ` Eli Zaretskii @ 2017-03-28 8:33 ` Tino Calancha 2017-03-28 10:13 ` Andreas Schwab 0 siblings, 1 reply; 13+ messages in thread From: Tino Calancha @ 2017-03-28 8:33 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Tino Calancha, 26272, npostavs On Tue, 28 Mar 2017, Eli Zaretskii wrote: >> From: Tino Calancha <tino.calancha@gmail.com> >> Date: Tue, 28 Mar 2017 10:54:36 +0900 (JST) >> cc: Eli Zaretskii <eliz@gnu.org>, Tino Calancha <tino.calancha@gmail.com>, >> 26272@debbugs.gnu.org >> >> III) Wrong >> M-x cd RET /tmp// RET >> M-: (default-directory) RET >> => "/" > > Why is this wrong? It's a standard Emacs feature. I don't think is wrong, indeed is consistent with the behaviour in Bug#21454. I was just a bit sorprise that the result is different in interactive calls compared with: M-: (cd "/tmp//") RET M-: (default-directory) RET => "/tmp/" ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-28 8:33 ` Tino Calancha @ 2017-03-28 10:13 ` Andreas Schwab 2017-03-28 11:26 ` Tino Calancha 0 siblings, 1 reply; 13+ messages in thread From: Andreas Schwab @ 2017-03-28 10:13 UTC (permalink / raw) To: Tino Calancha; +Cc: 26272, npostavs On Mär 28 2017, Tino Calancha <tino.calancha@gmail.com> wrote: > On Tue, 28 Mar 2017, Eli Zaretskii wrote: > >>> From: Tino Calancha <tino.calancha@gmail.com> >>> Date: Tue, 28 Mar 2017 10:54:36 +0900 (JST) >>> cc: Eli Zaretskii <eliz@gnu.org>, Tino Calancha <tino.calancha@gmail.com>, >>> 26272@debbugs.gnu.org >>> >>> III) Wrong >>> M-x cd RET /tmp// RET >>> M-: (default-directory) RET >>> => "/" >> >> Why is this wrong? It's a standard Emacs feature. > I don't think is wrong, indeed is consistent with the behaviour > in Bug#21454. > I was just a bit sorprise that the result is different in > interactive calls compared with: > M-: (cd "/tmp//") RET > M-: (default-directory) RET > => "/tmp/" substitute-in-file-name is a feature of reading the argument interactively, before the argument is passed to the command. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-28 10:13 ` Andreas Schwab @ 2017-03-28 11:26 ` Tino Calancha 0 siblings, 0 replies; 13+ messages in thread From: Tino Calancha @ 2017-03-28 11:26 UTC (permalink / raw) To: Andreas Schwab; +Cc: Tino Calancha, 26272, npostavs On Tue, 28 Mar 2017, Andreas Schwab wrote: >> I don't think is wrong, indeed is consistent with the behaviour >> in Bug#21454. >> I was just a bit sorprise that the result is different in >> interactive calls compared with: >> M-: (cd "/tmp//") RET >> M-: (default-directory) RET >> => "/tmp/" > > substitute-in-file-name is a feature of reading the argument > interactively, before the argument is passed to the command. > > Andreas. I see, then it was my misunderstanding. Thank you Andreas. ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26272: default-directory: Remark that it must be a directory name 2017-03-27 14:43 ` Eli Zaretskii 2017-03-27 15:15 ` Tino Calancha @ 2017-03-31 8:25 ` Tino Calancha 1 sibling, 0 replies; 13+ messages in thread From: Tino Calancha @ 2017-03-31 8:25 UTC (permalink / raw) To: 26272-done Eli Zaretskii <eliz@gnu.org> writes: > Here's my suggestion: > > It should be a directory name (as opposed to a directory file-name). > On GNU and Unix systems, directory names and in a slash `/'. > > This basically says what your original description said, which is spot > on. > > Thanks. Thank you. Pushed fix into Emacs-25 with commit: 84938d79698c1725016e2bc6480d5d73cc769a81 ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-03-31 8:25 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-03-27 10:13 bug#26272: default-directory: Remark that it must be a directory name Tino Calancha 2017-03-27 14:43 ` Eli Zaretskii 2017-03-27 15:15 ` Tino Calancha 2017-03-27 15:32 ` Eli Zaretskii 2017-03-27 15:52 ` Noam Postavsky 2017-03-27 18:26 ` Eli Zaretskii 2017-03-27 19:23 ` Noam Postavsky 2017-03-28 1:54 ` Tino Calancha 2017-03-28 2:32 ` Eli Zaretskii 2017-03-28 8:33 ` Tino Calancha 2017-03-28 10:13 ` Andreas Schwab 2017-03-28 11:26 ` Tino Calancha 2017-03-31 8:25 ` Tino Calancha
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.