I am new to (doom) Emacs, and I have almost no understanding of Emacs-Lisp yet. I have a simple function I copied from system-crafters blog to quickly insert an org-roam-capture
to an inbox
file. I am trying to modify it to include my system hostname in the file name, and in the file's tile. The following is the slightly modified and working snippet I use:
(defun my/org-roam-capture-inbox ()
(interactive)
(org-roam-capture- :node (org-roam-node-create)
:templates '(("i" "inbox" plain "* %?"
:if-new (file+head "inbox/main.org" "#+title: Main Inbox\n")))))
I found that the (system-name)
function could be used to retrieve the system hostname, and that %var
can be used in a string to reference the var
value. So, I tried the following:
(defun my/org-roam-capture-inbox ()
(defvar my-host nil)
(interactive)
(setq my-host (system-name))
(org-roam-capture- :node (org-roam-node-create)
:templates '(("i" "inbox" plain "* %?"
:if-new (file+head "inbox/%my-host.org" "#+title: %my-host Inbox\n")))))
I also tried to set the defvar
part globally meaning, outside of my/org-roam-capture-inbox
function. But this attempt simply uses %my-host
as a litteral string value.
%var
can be used in a string to reference thevar
value? That is generally not true.concat
, and then try and use it as a variable where it is needed. But above all, I think I should study the basics of elisp like declaring variables or calling functions before I ask for help. I am sorry I asked too quickly, can someone let me know how I should proceed ?elisp
tag: it tends to be misused frequently to the point of meaninglessness, so he deleted that tag and replaced it withorg-roam
. If you click on the link in his comment, you can read more about what the tag really means. So you posted to the right place. Second, the question seems reasonable: you posted what you tried and asked a question about it. The problem might be that the intersection of the set of people who might be willing to answer and the set of people who know something aboutorg-roam
is probably small ...C-h i g(eintr) RET
and start reading. It is also available on the Web, but learning to use Info in Emacs is very much worth your while.