Questions tagged [backquote]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
38
votes
2answers
5k views

How to evaluate the variables before adding them to a list?

The below obviously doesn't work and hence this question. How do I correct the below code so that the value of somelist becomes '(("abc" . 123)) ? (setq x "abc") (setq y 123) (setq somelist nil) (...
19
votes
2answers
5k views

What is the point of quote with single argument and comma? (quote ,arg)

(quote x) makes x not be evaluated, but adding a , in front of x within quote makes it evaluated. What is then the point of using quote with a single argument with a comma in front of it, like so: (...
5
votes
1answer
861 views

Backward quote, what does it mean in elisp?

I was referring the source code of switch-to-buffer in elisp source code, window.el.gz. I am seeing some backward single quotes like, ` I know single quote is used to refer to symbols but what does ...
5
votes
2answers
1k views

defun vs defmacro and backquote vs list

While looking to exclude the uses of the list function through the backquote substitutes in defmacros, my attempt failed when combined with the let and `let* recipe, together with the gensym ...
5
votes
1answer
351 views

Is there any difference between \` and backquote?

I was surprised to find that if I use M-x ielm, I get a literal backquote: ELISP> (read "`foo") `foo However, if I use M-: (read "`foo") then *Messages* and the minibuffer show (\` foo). Are ...
4
votes
2answers
378 views

Elisp backquote comma eval puts a space in between

Here's an example: (defmacro test (arg) `(message foo-,arg)) (defmacro test-with-space (arg) `(message foo- ,arg)) (macroexpand-1 '(test-with-space bar)) (macroexpand-1 '(test bar)) Both eval ...
3
votes
1answer
210 views

How to highlight back-tick quoted strings in code-comments?

Since back-ticks are often used for literals, is there a way I can highlight these in code comments? So this: # This is a comment, this is a literal: `4 + 4`. # let's make things interesting (`...
2
votes
1answer
199 views

eval and quotes

I am trying to execute the code here, which I copy below (defun buffer-local-set-key (key func) (interactive "KSet key on this buffer: \naCommand: ") (let ((name (format "%s-magic" (...
2
votes
1answer
185 views

How to use ,var-name (defvar) syntax in org-publish-project-alist? Init file is in form of org-mode

I have following function as part of my emacs configuration.org settings for publishing org to html. (defvar website-html-preamble "<nav> <ul class="nav nav-tabs"> <li role="...
2
votes
1answer
196 views

Concat in Org Easy Templates [duplicate]

I have a variety of org easy templates. I have a new file template which includes a #+DATE header that I'd like to populate with the current date [at the time the template is called]. The ...
1
vote
1answer
1k views

Can I eval a value in quote? [duplicate]

I have a variable say some-var, its value is a string. I want to use its value in a quote expression. '(some-var "some string") The function who is using the above expression reports error because ...
1
vote
1answer
75 views

Are there implicit evaluation rules for backquoted structures?

I was constructing a macro that nested another macro and I ran into something that confused me. If the backquoted macro was the last form in the defmacro it evaluated as expected. If added an ...
1
vote
1answer
48 views

Adding keywords programmatically using the display property

I've added some keywords using the following construct (where tag-todo and tag-note are variable holding a SVG image and tag-key () is a function returning a SVG image): (font-lock-add-keywords nil ...
1
vote
1answer
165 views

Unconsumed commas in double-backquoted lists

I'm writing a macro which calls a helper function. I need to return a list like this: `(s -- (cons 'commentary s)) I have tried many combinations, but I can't seem to get what I need without an ...
1
vote
1answer
74 views

What is missing to show the desktop-dirname in the frame title? [duplicate]

I tried to get the value of desktop-dirname into the title of a frame: (setq frame-title-format '("%b Desktop: " (car (last (split-string desktop-dirname "/" t))))) The (...
1
vote
0answers
14 views

Passing string as arg to apply function [duplicate]

I want to call clone-indirect-buffer or clone-indirect-buffer-other-window within a function dependent on the prefix. To do this, I assign the appropriate clone function to a variable using let. ...
1
vote
0answers
22 views

Include an element in a backquoted list only if it is non-nil

This is the "am I missing something obvious?" kind of question. I would like to use backquotes in some way to make a value appear in a list only if it's not nil. So, for instance, given x, ...
0
votes
2answers
31 views

How to properly use defcustom with backquote / comma grammar? (to edit a mode's font-lock-keywords)

I'm trying to edit a mode's font-lock-keywords variable to use defcustom instead of defconst (which it was using previously). Obviously, this is because I want to be able to easily customize the mode'...
0
votes
1answer
44 views

cons a symbol with a variable and return as a symbol [duplicate]

How can I make fun2 return as the same as fun1? (defun fun1 () '((hello . "test"))) ; <= returns ((hello . "test")) (defun fun2 (str) '((hello . str))) ; <= this is wrong! should return ((...
0
votes
1answer
168 views

Problems with setting the default font

I'm trying to set the default font for my Emacs based on a variable (so I can use a different font on a different machine): (setq fontspec (concat ck-font-name "-" (number-to-string ck-font-size))) (...
0
votes
1answer
66 views

string-join list with function as list member

I want to string-join a list of strings, one of which is returned by a function call. Like this: (defun foobar () "foobar") (string-join '("foo" (foobar) "bar") "|&...
0
votes
1answer
60 views

org-capture evaluate each time without currying

Recently my org-mode config broke. And i started using ` and , to get it to work again. But now i have the issue that a function call (dl/capture-report-date-file) gets evaluated once and curries the ...
0
votes
1answer
60 views

prin1 abbreviates form with "..." despite expression-print-level?

I have the following function to produce a form that can be "printed" to a ~/.gnus file to configure gnus to use a certain stmp and imap server for an account: (defun gnus-imap-smtp-form (email smtp-...
0
votes
0answers
32 views

What's the difference between ' (quote) and ` (grave accent) [duplicate]

I've seen both used to quote symbols and list. What's the difference between them? When should I use one or the other?
0
votes
0answers
38 views

elisp - construct a quasi-alist from variable [duplicate]

To construct a quasi-alist, case 1 is using hardcode string; case 2 is using a variable filename to replace the hadcode string. but case 2 doesn't work as expected (should the same as case 1). #+...
0
votes
0answers
102 views

alist error when value created using (concat string1 string2) [duplicate]

I'm really confused with what's happening here. In my config for backups I've the line (setq backup-directory-alist '(("" . "~/.emacs.d/backup/per-save"))) and I've a defined a variable in my init....
0
votes
1answer
81 views

Cons interpolation

I want to be able to write a cons with some of the cells being placeholders for later evaluation. I know I can use backquote constructs, but it tries to evaluate the cons immediately. To clarify, ...