The general issue is that you need x and y to be evaluated before they get inserted in somelist. The issue with the quoted list (with ' as reader syntax) is that quote is a special form that does not evaluate its argument. According to the docstring:
Return the argument, without evaluating it. (quote x) yields x.
Warning: quote does ...
The comma is used in the context of a backquoted (a.k.a. quasiquoted) list, which allows you to evaluate some portions of the list selectively. See also this thread for an example of a use for backquoting.
A couple of simple examples:
(setq a "a's value" b "b's value" c "c's value")
'(a b c) ; => (a b c)
`(,a b ,c) ...
Do not quote the cons cell, because quoted expressions are not evaluated. That's exactly why one quotes - to prevent evaluation. But that's not what you want, so don't.
Instead use the form that creates a cons cell from two evaluated values, its arguments.
(cons x y)
Of course you can also quasiquote but that doesn't really make sense here, and looks ...
That's because it's inside a macro. A macro needs to return a Lisp form, which then in turn gets evaluated.
For example, looking at the first invocation of this macro:
(add-annoying-arrows-advice previous-line '(ace-jump-mode backward-paragraph isearch-backward ido-imenu smart-up))
We need the expansion to contain:
(put 'previous-line 'aa-alts '(ace-...
C-h i, choose the Elisp manual.
You'll get to node Backquote, where you'll find a complete explanation of how backquotes are used in Emacs Lisp.
The first paragraph provides a summary description:
"Backquote constructs" allow you to quote a list, but selectively
evaluate elements of that list. In the simplest case, it is ...
You have two options:
1) Don't use quotes at all, as in:
(list some-var "some-string")
2) Use a backquote. They work like quotes, but part of an expression can be evaluated by using , and ,@. For example:
The short answer is that this is expected behaviour.
You seem to be expecting foo-,arg to be something like (intern (concat "foo-" (symbol-name ',arg))), but there's no reason why that should be the case.
For starters ,arg evaluates arg to whatever arbitrary lisp object it has as its value, so there mightn't even be a sensible way to form the end of a ...
The value returned by the sexp (read "`foo") is `foo.
You are confused by the form of the printing of the read value by the
command you are using (eval-expression, bound to M-: by default). What it prints is a Lisp representation of the value. If you instead use pp-eval-expression then you see `foo, which is the (same) value printed for humans. (This is ...
It's not necessary to use a backquote inside another, that's the beauty of it.
(defmacro m1 (a &optional b)
(let ((z (gensym)))
`(let ((,z (if (integerp ,b)
(list ,a ,b)
But that isn't correct yet. The purpose of z isn't to add another variable for the fun of it, but to protect b from ...
LISP is simple business:
function calls receive their arguments evaluated, their result is used verbatim
macro calls receive their arguments un-evaluated, their result is used evaluated
Other than that, you can almost look at macros as functions. In your
case, since the arguments are strings, they're the same whether
evaluated or not, so the difference ...
Use font-lock-add-keywords for to add extra fontification.
See the documentation of font-lock-keywords. You especially need the OVERRIDE flag to override the normal fontification of the comment.
Use a function as MATCHER. That function should search for the next comment or make sure that you are in one. Afterwards it should search for your literals.
There are several things wrong with the code:
You need #', (or just ',) in front of func. Inside a backquote expression, just func would result in the literal symbol func, not its value as a variable. Use comma (, to evaluate it. But then quote that evaluated result.
You need to use kbd, or else you are trying to bind the key sequence C-x SPC k.
You need ...
You need to use a back quote if you want the variables with commas to be replaced. See here.
But that's not where the error is coming from. You don't appear to have escaped the quote characters inside your preamble string. Reference
As @Drew mentioned in the comments, you can accomplish this, almost, with quasi-quoting. The syntax is a little confusing. The variable org-structure-template-alist is initialized as an alist:
'(("s" "#+BEGIN_SRC ?\n\n#+END_SRC")
You want to insert an element ...
It looks to me like you misunderstand the logic of the backquote. Even though it allows evaluation of code (instead of simply using the quoted value), it is still evaluated at runtime. That is, defcustom does receive a value in the same sense that a quoted list produces a value. Which is why if you look at the stored customizations in your custom.el file, ...
It's not clear (to me) what you want. The closest you seem to come to it is this, which is also not very clear:
"I just want it to keep using the backquote instead. Or somehow dynamically embed the variable reference there. But I don't see a way to do this."
Can you specify what you want as the value of the option, and how you want to be able to ...
A quoted list doesn't evaluate its args, so it consists of a string, a list containing a symbol and another string. You can selectively evaluate it using backquote and unquote:
`("foo" ,(foobar) "bar") ;=> ("foo" "foobar" "bar")
(string-join `("foo" ,(foobar) "bar") "|") ;=>...
This may get you there. (Do you really want/need a \ before each colon (:)?)
(defun foo ()
(font-lock-add-keywords nil (mapcar 'bar tags)))
(defun bar (pat.fac)
(let ((pat (format "\\(%s\\)" (car pat.fac)))
(fac (cdr pat.fac)))
(when (eq fac 'tag-key) (setq fac '(tag-key (match-string 0))))
According to (info "(org) Template elements"), when setting capture target, instead of supplying a filename, you can also use a function:
Most general way: write your own
function which both visits the file and moves point to the right
You can take a look at the following as an example, it picks a ...
You are passing a literal list as the second arg to setq. Instead, you want to substitute the value of the (car...) sexp.
You can do that using a backquote construction, telling it to evaluate that (car...) sexp and use the result of the evaluation.
You want this:
(setq frame-title-format `("%b Desktop: "
,(car (last (split-...
Using setf instead of a let binding to set the value of print-level and print-depth worked, though I'm not sure I understand why:
(progn (setf print-level 2
(pp `(deeply (nested (form (very (deeply (nested))))))))
"(deeply\n (nested ...))\n"
Setting to nil:
(progn (setf print-level nil