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 ...
If you are trying to use the variable itself, then use 'some-variable. If you are trying to use the value stored in the variable, use some-variable.
boundp uses symbol so it will look at anything that can be bound, including functions.
It only cares whether there is a symbol that matches, not what the value is.
bound-and-truep uses var and ...
In Emacs Lisp, if foo is a symbol, then 'foo and #'foo are completely equivalent. The latter form (with #') is preferred when foo is a function, as it documents the fact that it is intended to be funcalled.
Your two forms are therefore completely equivalent, and the one with #' is preferred.
Edit: as pointed out by Malabarba, this is not quite true: #' on ...
Here is my answer to the identical question, appropriately edited:
foo is self-modifying code. This is extremely dangerous. While the variable lst disappears at the end of the let form, its initial value persists in the function object, and that is the value you are modifying. Remember that in Lisp a function is a first class object, which can be ...
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 ...
A symbol which is in non-function position is treated as the name of a variable. In (function variable) function is in function-position (after the opening parenthesis) and variable is not. Unless explicitly quoted variables are replaced with their values.
If you were to write (boundp my-variable) that would mean "is the symbol which is stored in the value ...
#' is just shorthand for function, just as ' is shorthand for quote.
You can use it anywhere where you want to indicate to the byte-compiler or the interpreter or a human reader that its argument is expected to be (is treated as) a function.
In many contexts the context determines how the argument is treated if, for example, you simply quote it (use quote ...
Short version: remove the inner quote.
When you quote a list, it leaves the list's contents unevaluated:
'(a-symbol "a string" (+ 1 1)) => (a-symbol "a string" (+ 1 1))
So: if the list includes symbols, a quoted list will return a
list of symbols. Here's the rub: because quoting is so common,
there's a special reader syntax for
it: '. So:
#' (aka function) can be used in front of (lambda ...) but it's redundant there, so the only place where it's really meaningful is in front of a symbol, as in #'car. In ELisp, #'car and 'car are almost completely equivalent, so one of the main purpose is simply to document the intention (i.e. to indicate to whoever reads this code that you intend to use ...
M-C-f (or M-C-right) bound to forward-sexp should do that.
I suggest you try all well-known motion commands with the prefix M-C- instead of C-.
M-C-b (or M-C-left) gives backward-sexp
M-C-u (or M-C-up) gives backward-up-list
M-C-n (or M-C-down) gives forward-list
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:
Replace func2 with #'func2:
(defun func2 (arg)
(if (listp arg)
(mapcar #'func2 arg)
Emacs Lisp is a lisp-2 (like Common Lisp), not lisp-1 (unlike, say, Scheme).
I.e., every symbol in ELisp has a
"value cell": accessed by symbol-value, tested by boundp, and used by the compiler when the symbol is in the "...
Add the following to your emacs init file:
(if (char-equal c ?\") t (electric-pair-default-inhibit c))))
Reference from my blog post: https://www.topbug.net/blog/2016/09/29/emacs-disable-certain-pairs-for-electric-pair-mode/
Okay, figured it out! Because the template was quoted '(("j"... the concat expression was not being evaluated. What I needed to do was use backquote and then insert a , before the concat statement to allow this part to evaluate:
`(("j" "Journal" entry (file+datetree "~/org/journal.org")
,(concat "* " (format-time-string ...
;; Broken. Which is weird, since it came straight from the *Help* for go-mode
This almost definitely indicates another case of the recently-introduced (25.1) text-quoting-style default behaviour screwing things up for people in hard-to-notice ways :(
I recommend two things:
Submit a bug report for go-mode. The docstring in question will need to use the ...
Don't quote buffer-assassin when passing it to ninrod--protection. In your advice-functions, buffer-assassin is a variable, the value of which is the originial function. When you pass it quoted, buffer-assassin in ninrod--protection will have the value 'buffer-assassin (i.e. the symbol itself), so apply will try calling a (global) function named like that, ...
Maybe this will clear up some of the confusion:
Your function initilize does not initialize variable example. It sets it to a particular cons cell - the same cons cell each time it is called. The first time initilize is called, the setq assigns example to a new cons cell, which is the result of evaluating '(3). Subsequent calls to initilize just reassign ...
You can use (setq example (list 3)) to avoid this error.
What happens is init assigns an object that initially contains (3) to example.
It sets the value of the object only once. Subsequently, you modify this value.
Here's your example in C++, if you understand that better:
char* storage = ...
After reading the comments, it appears you're really looking for this:
org-narrow-to-block to narrow the buffer to the current block
Place cursor within the boundary of a block, e.g. quote block
Type C-x n b
The buffer will ...
Comma and backquote are transformed by the reader into regular function calls with the following sexp as argument.
(read "`(list ,fill-column `(list ,fill-column))")
;; => (\` (list (\, fill-column) (\` (list (\, fill-column)))))
You can look-up the backquote macro's help. Comma is actually not a macro, but like a marker for backquote, i.e. it's ...
(add-hook 'coffee-mode-hook '(lambda () (coffee-custom)))
Definitely not recommended.
Quoting lambdas like that is not good practice.
As you say, (add-hook 'coffee-mode-hook #'coffee-custom) would be better (for many reasons).
In coffee-mode.el you can see similar hook call
"... Add `'(lambda () (coffee-cos-mode t))' to `coffee-mode-hook'
This one ...
The quote (') causes the following expression to be not evaluated, therefore blog-username and blog-password are not evaluated to their string values, but instead taken as symbols.
One way of getting around this is using the list function to explicitly quote symbols when necessary (note that the colon automatically quotes keywords):
I don't see an issue. Just macroexpand your stuff and you'll see the obvious errors:
(progn (add-to-list (quote annoying-commands)
(put (quote next-line)
Use a straight quote ('), not a typographically correct one (’). This goes for programming in general, nearly all languages out there stick to the ASCII character set. Emacs helpfully displays the quotes in the typographically correct way, this breaks copy-pasting them into your own code.
If I understood correctly, you are looking for the command message-fill-yanked-message, which is bound to C-c C-q in message-mode by default. See the Message Manual node on Insertion for a brief description of this command, including a caveat.
In fact, message-mode is so powerful and flexible that I recommend reading its whole manual, which is relatively ...
C-h v print-quoted:
print-quoted is a variable defined in C source code.
Its value is nil
Non-nil means print quoted forms with reader syntax.
I.e., (quote foo) prints as 'foo, (function foo) as #'foo.
Interesting question. I put together this start based on this part of the manual. How you set this up will depend on how you want to use it. Based on my experiments, it seems easier to define a new exporter, like the manual suggests, than it is to redefine the latex one.
(defun my-org-latex-quote-block (quote-block contents info)
"Transcode a QUOTE-BLOCK ...
It appears you cannot. The various customizations only allow you to add pairs.
If you're willing to use a different package to do your pairing, you can try smartparens. You can set quotation marks to not pair as follows:
(sp-pair "'" nil :actions :rem)
(sp-pair "\"" nil :actions :rem)
'foo and (quote foo) are identical: they prevent evaluation of foo.
#'foo and (function foo) are also identical: they extract the function binding of foo, including at compile time, which means that the function gets compiled.
So, if you want a symbol, use 'foo:
if you want a function, use #'foo: