unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Files that begin with a period
@ 2008-10-19 10:29 Eli Zaretskii
  2008-10-19 13:07 ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2008-10-19 10:29 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-devel

I installed today in several Lisp files, including in the `lisp/org'
directory, changes that run file names which supply values to
defcustom's through `convert-standard-filename'.  This is for when
Emacs runs on 8+3 (a.k.a. DOS) filesystems that do not allow file
names with a leading period.  (On modern filesystems,
`convert-standard-filename' leaves the file name intact.)

The changes to the Org files appear below, for your convenience when
merging them with your repository.

Thanks.


2008-10-19  Eli Zaretskii  <eliz@gnu.org>

	* org.el (org-default-notes-file): 
	* org-publish.el (org-publish-timestamp-directory): 
	* org-id.el (org-id-locations-file): Run file names that begin
	with a period thru `convert-standard-filename'.

Index: org/org.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/org/org.el,v
retrieving revision 1.16
diff -u -r1.16 org.el
--- org/org.el	12 Oct 2008 06:12:47 -0000	1.16
+++ org/org.el	19 Oct 2008 10:16:49 -0000
@@ -1204,7 +1204,7 @@
   :group 'org-remember
   :type 'directory)
 
-(defcustom org-default-notes-file "~/.notes"
+(defcustom org-default-notes-file (convert-standard-filename "~/.notes")
   "Default target for storing notes.
 Used by the hooks for remember.el.  This can be a string, or nil to mean
 the value of `remember-data-file'.
Index: org/org-publish.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/org/org-publish.el,v
retrieving revision 1.8
diff -u -r1.8 org-publish.el
--- org/org-publish.el	12 Oct 2008 06:12:46 -0000	1.8
+++ org/org-publish.el	19 Oct 2008 10:17:17 -0000
@@ -276,7 +276,8 @@
   :group 'org-publish
   :type 'boolean)
 
-(defcustom org-publish-timestamp-directory "~/.org-timestamps/"
+(defcustom org-publish-timestamp-directory
+  (convert-standard-filename "~/.org-timestamps/")
   "Name of directory in which to store publishing timestamps."
   :group 'org-publish
   :type 'directory)
Index: org/org-id.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/org/org-id.el,v
retrieving revision 1.5
diff -u -r1.5 org-id.el
--- org/org-id.el	12 Oct 2008 06:12:45 -0000	1.5
+++ org/org-id.el	19 Oct 2008 10:17:28 -0000
@@ -116,7 +116,7 @@
   :group 'org-id
   :type 'boolean)
 
-(defcustom org-id-locations-file "~/.org-id-locations"
+(defcustom org-id-locations-file (convert-standard-filename "~/.org-id-locations")
   "The file for remembering the last ID number generated."
   :group 'org-id
   :type 'file)




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-19 10:29 Files that begin with a period Eli Zaretskii
@ 2008-10-19 13:07 ` Stefan Monnier
  2008-10-19 13:39   ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2008-10-19 13:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, Carsten Dominik

> I installed today in several Lisp files, including in the `lisp/org'
> directory, changes that run file names which supply values to
> defcustom's through `convert-standard-filename'.  This is for when
> Emacs runs on 8+3 (a.k.a. DOS) filesystems that do not allow file
> names with a leading period.  (On modern filesystems,
> `convert-standard-filename' leaves the file name intact.)

It would probably be good to try and use user-emacs-directory for those
file names.


        Stefan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-19 13:07 ` Stefan Monnier
@ 2008-10-19 13:39   ` Eli Zaretskii
  2008-10-19 20:04     ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2008-10-19 13:39 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, dominik

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Carsten Dominik <dominik@science.uva.nl>,  emacs-devel@gnu.org
> Date: Sun, 19 Oct 2008 09:07:44 -0400
> 
> > I installed today in several Lisp files, including in the `lisp/org'
> > directory, changes that run file names which supply values to
> > defcustom's through `convert-standard-filename'.  This is for when
> > Emacs runs on 8+3 (a.k.a. DOS) filesystems that do not allow file
> > names with a leading period.  (On modern filesystems,
> > `convert-standard-filename' leaves the file name intact.)
> 
> It would probably be good to try and use user-emacs-directory for those
> file names.

Sorry, I don't understand what would that solve.  I'm talking about
defcustom's such as this one:

    (defcustom org-id-locations-file
      (convert-standard-filename "~/.org-id-locations")
       "The file for remembering the last ID number generated."
       :group 'org-id
       :type 'file)

(Originally, the call to convert-standard-filename wasn't there.)

The file in question is in the user's home directory, but the problem
is not the directory, it's the name of the file itself.

What am I missing?




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-19 13:39   ` Eli Zaretskii
@ 2008-10-19 20:04     ` Stefan Monnier
  2008-10-20  9:03       ` Juanma Barranquero
  2008-10-20  9:33       ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Stefan Monnier @ 2008-10-19 20:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, dominik

>> > I installed today in several Lisp files, including in the `lisp/org'
>> > directory, changes that run file names which supply values to
>> > defcustom's through `convert-standard-filename'.  This is for when
>> > Emacs runs on 8+3 (a.k.a. DOS) filesystems that do not allow file
>> > names with a leading period.  (On modern filesystems,
>> > `convert-standard-filename' leaves the file name intact.)
>> 
>> It would probably be good to try and use user-emacs-directory for those
>> file names.

> Sorry, I don't understand what would that solve.  I'm talking about
> defcustom's such as this one:

>     (defcustom org-id-locations-file
>       (convert-standard-filename "~/.org-id-locations")
>        "The file for remembering the last ID number generated."
>        :group 'org-id
>        :type 'file)

> (Originally, the call to convert-standard-filename wasn't there.)

> The file in question is in the user's home directory, but the problem
> is not the directory, it's the name of the file itself.

> What am I missing?

Nothing: I agree 100% with your change and just reminded that it would
additionally be good to try and use user-emacs-directory (i.e. move
those files into ~/.emacs.d).


        Stefan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-19 20:04     ` Stefan Monnier
@ 2008-10-20  9:03       ` Juanma Barranquero
  2008-10-20 11:19         ` Eli Zaretskii
  2008-10-20  9:33       ` Eli Zaretskii
  1 sibling, 1 reply; 14+ messages in thread
From: Juanma Barranquero @ 2008-10-20  9:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On Sun, Oct 19, 2008 at 22:04, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> Nothing: I agree 100% with your change and just reminded that it would
> additionally be good to try and use user-emacs-directory (i.e. move
> those files into ~/.emacs.d).

Sixteen months ago we had a longish thread about introducing a new
function to help defaulting configuration files to .emacs.d (and
changing the name of `user-emacs-directory'):

http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg00755.html

I have an old patch with the following:

--- lisp/subr.el        13 Jun 2007 00:03:28 -0000      1.555
+++ lisp/subr.el        25 Jun 2007 13:13:33 -0000
@@ -2042,5 +2042,5 @@
 (put 'cl-assertion-failed 'error-message "Assertion failed")

-(defconst user-emacs-directory
+(defconst user-data-directory
   (if (eq system-type 'ms-dos)
       ;; MS-DOS cannot have initial dot.
@@ -2049,5 +2049,21 @@
   "Directory beneath which additional per-user Emacs-specific files are placed.
 Various programs in Emacs store information in this directory.
-Note that this should end with a directory separator.")
+Note that this should end with a directory separator.
+See also `locate-user-data-path'.")
+
+(defun locate-user-data-path (new-name &optional old-name)
+  "Return an absolute per-user Emacs-specific path.
+If OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME.
+Else return NEW-NAME in `user-data-directory', creating the
+directory if it does not exist."
+ (convert-standard-filename
+  (let* ((home (concat "~" (or init-file-user "")))
+        (at-home (and old-name (expand-file-name old-name home))))
+    (if (and at-home (file-readable-p at-home))
+       at-home
+      (unless (or purify-flag                    ;; don't create dir
while dumping
+                 (file-accessible-directory-p (directory-file-name
user-data-directory)))
+        (make-directory user-data-directory t))  ;; don't catch errors
+      (expand-file-name new-name user-data-directory)))))

The idea was to help converting something like this:

(defcustom savehist-file
  (cond
   ;; Backward compatibility with previous versions of savehist.
   ((file-exists-p "~/.emacs-history") "~/.emacs-history")
   ((and (not (featurep 'xemacs)) (file-directory-p user-emacs-directory))
    (concat user-emacs-directory "history"))
   ((and (featurep 'xemacs) (file-directory-p "~/.xemacs/"))
    "~/.xemacs/history")
   ;; For users without `~/.emacs.d/' or `~/.xemacs/'.
   (t (convert-standard-filename "~/.emacs-history")))
  ...)

into

(defcustom savehist-file
  (locate-user-data-path "history" ".emacs-history")
  ...)

In the thread there was much discussion about names, and I haven't
tried to maintain the patch up-to-date. I still think a function like
this one would be helpful, though.

  Juanma




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-19 20:04     ` Stefan Monnier
  2008-10-20  9:03       ` Juanma Barranquero
@ 2008-10-20  9:33       ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2008-10-20  9:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, dominik

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: dominik@science.uva.nl,  emacs-devel@gnu.org
> Date: Sun, 19 Oct 2008 16:04:32 -0400
> 
> it would additionally be good to try and use user-emacs-directory
> (i.e. move those files into ~/.emacs.d).

I agree.  Perhaps we should add this to the Hints in ELisp manual.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-20  9:03       ` Juanma Barranquero
@ 2008-10-20 11:19         ` Eli Zaretskii
  2008-10-20 11:32           ` Juanma Barranquero
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2008-10-20 11:19 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: monnier, emacs-devel

> Date: Mon, 20 Oct 2008 11:03:27 +0200
> From: "Juanma Barranquero" <lekktu@gmail.com>
> Cc: emacs-devel@gnu.org
> 
> Sixteen months ago we had a longish thread about introducing a new
> function to help defaulting configuration files to .emacs.d (and
> changing the name of `user-emacs-directory'):
> 
> http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg00755.html
> 
> I have an old patch with the following:
> 
> --- lisp/subr.el        13 Jun 2007 00:03:28 -0000      1.555
> +++ lisp/subr.el        25 Jun 2007 13:13:33 -0000
> @@ -2042,5 +2042,5 @@
>  (put 'cl-assertion-failed 'error-message "Assertion failed")
> 
> -(defconst user-emacs-directory
> +(defconst user-data-directory

I'm okay with this change, but I think we shouldn't rename the
constant.  There's no need to, really, and doing so introduces
gratuitous back-compatibility problems.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-20 11:19         ` Eli Zaretskii
@ 2008-10-20 11:32           ` Juanma Barranquero
  2008-10-20 12:07             ` Eli Zaretskii
  2008-10-23 18:29             ` Stefan Monnier
  0 siblings, 2 replies; 14+ messages in thread
From: Juanma Barranquero @ 2008-10-20 11:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: monnier, emacs-devel

On Mon, Oct 20, 2008 at 13:19, Eli Zaretskii <eliz@gnu.org> wrote:

> I'm okay with this change, but I think we shouldn't rename the
> constant.  There's no need to, really, and doing so introduces
> gratuitous back-compatibility problems.

I'm quite agnostic about the names, but a *great* deal of the thread
was choosing appropriate ones, and XEmacs compatibility and prior art
were involved. Stephen J. Turnbull participated in the discussion and
was willing to add the function to XEmacs, IIRC.

  Juanma




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-20 11:32           ` Juanma Barranquero
@ 2008-10-20 12:07             ` Eli Zaretskii
  2008-10-23 18:29             ` Stefan Monnier
  1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2008-10-20 12:07 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: monnier, emacs-devel

> Date: Mon, 20 Oct 2008 13:32:15 +0200
> From: "Juanma Barranquero" <lekktu@gmail.com>
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> 
> On Mon, Oct 20, 2008 at 13:19, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > I'm okay with this change, but I think we shouldn't rename the
> > constant.  There's no need to, really, and doing so introduces
> > gratuitous back-compatibility problems.
> 
> I'm quite agnostic about the names, but a *great* deal of the thread
> was choosing appropriate ones, and XEmacs compatibility and prior art
> were involved. Stephen J. Turnbull participated in the discussion and
> was willing to add the function to XEmacs, IIRC.

If compatibility with XEmacs is the reason for the renaming, the
proper vehicle for dealing with that is defalias, not a new name, IMO.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-20 11:32           ` Juanma Barranquero
  2008-10-20 12:07             ` Eli Zaretskii
@ 2008-10-23 18:29             ` Stefan Monnier
  2008-10-23 21:49               ` Eli Zaretskii
                                 ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Stefan Monnier @ 2008-10-23 18:29 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Eli Zaretskii, emacs-devel

>> I'm okay with this change, but I think we shouldn't rename the
>> constant.  There's no need to, really, and doing so introduces
>> gratuitous back-compatibility problems.

> I'm quite agnostic about the names, but a *great* deal of the thread
> was choosing appropriate ones, and XEmacs compatibility and prior art
> were involved. Stephen J. Turnbull participated in the discussion and
> was willing to add the function to XEmacs, IIRC.

Please install your locate-user-data-path function, except "path" should
be changed to "file" and "data" might need to be changed to "emacs"
because: as for user-emacs-directory vs user-data-directory, I don't see
the advantage of user-data-directory: AFAIK XEmacs uses
user-init-directory, so XEmacs (in)compatibility is not the issue.


        Stefan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-23 18:29             ` Stefan Monnier
@ 2008-10-23 21:49               ` Eli Zaretskii
  2008-10-24  9:46                 ` Juanma Barranquero
  2008-10-24  4:18               ` Stephen J. Turnbull
  2008-10-24 10:25               ` Juanma Barranquero
  2 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2008-10-23 21:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: lekktu, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Thu, 23 Oct 2008 14:29:22 -0400
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> 
> Please install your locate-user-data-path function, except "path" should
> be changed to "file" and "data" might need to be changed to "emacs"

Please also make a NEWS entry for this function, because I believe we
should document it in ELisp manual to encourage its usage.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-23 18:29             ` Stefan Monnier
  2008-10-23 21:49               ` Eli Zaretskii
@ 2008-10-24  4:18               ` Stephen J. Turnbull
  2008-10-24 10:25               ` Juanma Barranquero
  2 siblings, 0 replies; 14+ messages in thread
From: Stephen J. Turnbull @ 2008-10-24  4:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Juanma Barranquero, Eli Zaretskii, emacs-devel

Stefan Monnier writes:

 > Please install your locate-user-data-path function, except "path" should
 > be changed to "file" and "data" might need to be changed to "emacs"
 > because: as for user-emacs-directory vs user-data-directory, I don't see
 > the advantage of user-data-directory: AFAIK XEmacs uses
 > user-init-directory, so XEmacs (in)compatibility is not the issue.

That's correct.

However, I will remark that over time user-init-directory has become
the (informal and unofficial) standard place for putting users'
"stuff", and `user-data-directory' might be a better name for it.
There's no reason why the user-init-file can't go into the
user-data-directory.  But all this is a matter of taste.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-23 21:49               ` Eli Zaretskii
@ 2008-10-24  9:46                 ` Juanma Barranquero
  0 siblings, 0 replies; 14+ messages in thread
From: Juanma Barranquero @ 2008-10-24  9:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, emacs-devel

On Thu, Oct 23, 2008 at 23:49, Eli Zaretskii <eliz@gnu.org> wrote:

> Please also make a NEWS entry for this function, because I believe we
> should document it in ELisp manual to encourage its usage.

Done, though the entry is lame (I'm somehow genetically unable to find
good, short descriptions). Feel free to improve it.

  Juanma




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Files that begin with a period
  2008-10-23 18:29             ` Stefan Monnier
  2008-10-23 21:49               ` Eli Zaretskii
  2008-10-24  4:18               ` Stephen J. Turnbull
@ 2008-10-24 10:25               ` Juanma Barranquero
  2 siblings, 0 replies; 14+ messages in thread
From: Juanma Barranquero @ 2008-10-24 10:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, emacs-devel

On Thu, Oct 23, 2008 at 20:29, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> Please install your locate-user-data-path function, except "path" should
> be changed to "file" and "data" might need to be changed to "emacs"

Done.

I've also changed simple uses of `user-emacs-directory'.

There are a few cases where it would be useful too, but I haven't
changed them because of the freeze.

 - cmuscheme.el: `scheme-start-file'

 - shell.el: `shell'

 - tutorial.el: I've used the new function in `tutorial--saved-dir',
but the right thing would be to get rid of this function altogether,
and simplify `tutorial--saved-file', `tutorial--save-tutorial',
`tutorial--save-tutorial-to', etc.

 - erc: `erc-user-emacs-directory' would be unnecessary, but there are
compatibility issues if erc is also maintained outside of the Emacs
CVS.

 - tramp-cache.el: `tramp-persistency-file-name' could be simplified,
but there's the same issue as with erc

 - term/x-win.el: `emacs-session-filename' would be a two-liner:

  (let ((basename (concat "session." session-id)))
    (locate-user-emacs-file basename (concat ".emacs-" basename)))

  but I cannot test the change.

      Juanma




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-10-24 10:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-19 10:29 Files that begin with a period Eli Zaretskii
2008-10-19 13:07 ` Stefan Monnier
2008-10-19 13:39   ` Eli Zaretskii
2008-10-19 20:04     ` Stefan Monnier
2008-10-20  9:03       ` Juanma Barranquero
2008-10-20 11:19         ` Eli Zaretskii
2008-10-20 11:32           ` Juanma Barranquero
2008-10-20 12:07             ` Eli Zaretskii
2008-10-23 18:29             ` Stefan Monnier
2008-10-23 21:49               ` Eli Zaretskii
2008-10-24  9:46                 ` Juanma Barranquero
2008-10-24  4:18               ` Stephen J. Turnbull
2008-10-24 10:25               ` Juanma Barranquero
2008-10-20  9:33       ` Eli Zaretskii

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).