Questions tagged [backquote]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
70 views

My Org mode capture code returns "Invalid file location: nil"

I use the following code for the org mode capture functionality, but it returns the error "Invalid file location: nil". What is wrong? Thanks in advance for any help! (setq org-capture-...
  • 1,049
0 votes
1 answer
39 views

How to use a variable for an output :file path for call-process

I'm using call-process in an emacs/lisp file (in Spacemacs) to run an external command and write its output to a file. It works when I hard code the path like this: (call-process "/bin/ls" ...
3 votes
1 answer
38 views

Interpolating inside a nested backquote expression

Consider this macro helper function that returns a backquote expression: (defun make-headers () `(:headers `(("Authorization" . ,(get-auth))))) This returns the list (:headers `(("...
  • 889
1 vote
1 answer
30 views

How to pass a variable to a click handler?

I'm using this code to make clickable text in a buffer: (defun q() "Entry point." (interactive) (let ((buffer-name "q")) (get-buffer-create buffer-name) (switch-to-...
  • 147
1 vote
1 answer
38 views

function accepts string literal, but not the result of expression

In my init.el I have a series of programming language specific hooks that I use to add font-lock patterns (namely adding a header style font to some of my comments). Here is an example for c-like ...
  • 13
1 vote
1 answer
97 views

Why is :box on set-face-attribute not getting the current value from (face-background)?

Why is :box not getting the current background color?. It doesn't even work if I setq a variable with the color hardcoded, but if I set the hex color as a literal it works perfectly. If I evaluate ...
  • 568
2 votes
1 answer
42 views

Key binding to `C-<` and `C->` not working when creating minor mode

I wrote a couple of functions to automatically convert sequences like "<<" in «. (Yeah, I know that input methods can do the same, but I don't want the extra bindings: I'm planning to ...
0 votes
1 answer
25 views

Function argument does not seem to be visible inside of function

I use this code (found here) to highlight a single line in black: (defun find-overlays-specifying (prop pos) (let ((overlays (overlays-at pos)) found) (while overlays (let ((...
  • 855
0 votes
1 answer
88 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, ...
  • 21
1 vote
0 answers
19 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. ...
  • 4,077
0 votes
2 answers
57 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'...
  • 1,300
0 votes
0 answers
34 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?
3 votes
1 answer
253 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 (`...
  • 7,687
0 votes
1 answer
404 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") "|&...
1 vote
0 answers
23 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, ...
  • 436
2 votes
1 answer
93 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 ...
2 votes
1 answer
269 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" (...
  • 1,479
2 votes
1 answer
245 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 ...
  • 210
0 votes
1 answer
92 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
1 answer
50 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 ((...
  • 207
1 vote
1 answer
207 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 ...
user avatar
1 vote
1 answer
81 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 (...
  • 461
0 votes
0 answers
41 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). #+...
  • 1,528
0 votes
1 answer
63 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-...
  • 823
0 votes
1 answer
179 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))) (...
  • 457
0 votes
0 answers
108 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....
2 votes
1 answer
235 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="...
3 votes
2 answers
256 views

How to evaluate a symbol in a lambda function when defining it?

For example, (lambda () (message "%s" x))) But I would like x to be evaluated -- the lambda function should always use that value, instead of the current value of x. How should I do it? Preferably ...
  • 1,759
4 votes
2 answers
474 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 ...
5 votes
1 answer
1k 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 ...
  • 1,917
5 votes
1 answer
375 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 ...
1 vote
1 answer
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 ...
  • 385
1 vote
1 answer
79 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 ...
  • 4,566
5 votes
2 answers
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 ...
  • 101
22 votes
2 answers
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: (...
40 votes
2 answers
7k 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) (...
  • 24.6k