Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
elisp help wanted for dynamic root of file path... [fixed]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Wed Jan 03, 2024 3:14 pm    Post subject: elisp help wanted for dynamic root of file path... [fixed] Reply with quote

Currently within setq()
Code:
auto-save-file-name-transforms `((".*" "~/.emacs.d/backups/" t))
works fine.

I'd like to use user-emacs-directory instead as in:
Code:
(list ".*" (concat user-emacs-directory "backups/") t)
which returns:
Code:
(".*" "~/.emacs.d/backups/" t)
Now only surrounding '() are missing, and I don't know how to achieve it.

Seems like it should be doable using a variable for the relative path, but this is just what I want to avoid.

Thks 4 ur attention, interest & support
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "


Last edited by CaptainBlood on Thu Jan 04, 2024 2:08 am; edited 3 times in total
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 370

PostPosted: Wed Jan 03, 2024 5:48 pm    Post subject: Reply with quote

If I understand you correctly, you are looking for something like

Code:
(setq auto-save-file-name-transforms `(( ".*" ,(file-name-concat user-emacs-directory "backups/") t)))
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Wed Jan 03, 2024 7:00 pm    Post subject: Reply with quote

That works, Nice

I also have similar issue with
Code:
undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo-tree"))

May be you also have a clue?

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 324
Location: Naarm/Melbourne, Australia

PostPosted: Wed Jan 03, 2024 11:11 pm    Post subject: Reply with quote

Perhaps i'm misunderstanding what you're after, but doesn't doing the same thing do what you want?
Code:
(setq undo-tree-history-directory-alist `(("." . ,(file-name-concat  user-emacs-directory "undo-tree/")))

or, if you want to be more explicit, rather than using quasiquoting:
Code:
(setq undo-tree-history-directory-alist (list (cons "." (file-name-concat user-emacs-directory "undo-tree/"))))
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Thu Jan 04, 2024 2:04 am    Post subject: Reply with quote

Both of you have saved my day.

I should explain I made a mistake in the first hardcoded path I provided, as original snippet doesn't require final /.
The second snippet is genuine in this respect.

I copied & pasted the first example, which worked seamlessly.

When I tried to apply my understanding of the 'recipe' to the second case I failed to add the final /.
Thus my second call for help.

As you might have guess, I still very noob when it comes to operation on lists.
Saying here "I understand quickly must must be taught for quite a while" 8O

Time for lisp homework :roll:

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum