Skip to main content

Short answer

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 returns the value. In this case you need to provide the value of the symbol to the function. If no symbol var is bound, or the value is nil then it will return nil.

Explanation

For the manual definition please see the manual.

' and (quote ...) both perform the same purpose in emacs-lisp.

The purpose of this is to pass the unevaluated form to the surrounding environment rather than evaluate it.

In your example assume we had the following higher up

(setq some-variable "less") ;; Rather than just 't for clarity
    (setq some-variable "less") ;; Rather than just 't for clarity

Then the evaluation goes as follows:

(when (boundp 'some-variable) 
   (message "some-variable is %s" some-variable))
;; ==> (boundp 'some-variable) ; 't
;; ==> some-variable is "less"
    (when (boundp 'some-variable) 
       (message "some-variable is %s" some-variable))
    ;; ==> (boundp 'some-variable) ; 't
    ;; ==> some-variable is "less"

Whereas without a quote:

(when (boundp some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))
;; ==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.

    (when (boundp some-variable) ;; Note that not using single-quote causes error
       (message "some-variable is %s" some-variable))
    ;; ==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.

Short answer

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 returns the value. In this case you need to provide the value of the symbol to the function. If no symbol var is bound, or the value is nil then it will return nil.

Explanation

For the manual definition please see the manual.

' and (quote ...) both perform the same purpose in emacs-lisp.

The purpose of this is to pass the unevaluated form to the surrounding environment rather than evaluate it.

In your example assume we had the following higher up

(setq some-variable "less") ;; Rather than just 't for clarity

Then the evaluation goes as follows:

(when (boundp 'some-variable) 
   (message "some-variable is %s" some-variable))
;; ==> (boundp 'some-variable) ; 't
;; ==> some-variable is "less"

Whereas without a quote:

(when (boundp some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))
;; ==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.

Short answer

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 returns the value. In this case you need to provide the value of the symbol to the function. If no symbol var is bound, or the value is nil then it will return nil.

Explanation

For the manual definition please see the manual.

' and (quote ...) both perform the same purpose in emacs-lisp.

The purpose of this is to pass the unevaluated form to the surrounding environment rather than evaluate it.

In your example assume we had the following higher up

    (setq some-variable "less") ;; Rather than just 't for clarity

Then the evaluation goes as follows:

    (when (boundp 'some-variable) 
       (message "some-variable is %s" some-variable))
    ;; ==> (boundp 'some-variable) ; 't
    ;; ==> some-variable is "less"

Whereas without a quote:

    (when (boundp some-variable) ;; Note that not using single-quote causes error
       (message "some-variable is %s" some-variable))
    ;; ==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.
Made the code snippets syntactically correct + added some polishing around the snippets
Source Link

Short answer

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 returns the value. In this case you need to provide the value of the symbol to the function. If no symbol var is bound, or the value is nil then it will return nil.

Explanation

For the manual definition please see the manual.

' and (quote ...) both perform the same purpose in emacs-lisp.

The purpose of this is to pass the unevaluated form to the surrounding environment rather than evaluate it.

In your example assume we had the following higher up

(setq some-variable "less") ;; Rather than just 't for clarity

Then the evaluation goes as follows:

(when (boundp 'some-variable) 
   (message "some-variable is %s" some-variable))
;; ==> (boundp 'some-variable) ; 't
;; ==> some-variable is "less"

Whereas without a quote:

(when (boundp some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))
;; ==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.

Short answer

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.

Explanation

For the manual definition please see the manual.

' and (quote ...) both perform the same purpose in emacs-lisp.

The purpose of this is to pass the unevaluated form to the surrounding environment rather than evaluate it.

In your example assume we had the following higher up

(setq some-variable "less") ;; Rather than just 't for clarity

Then the evaluation goes as follows:

(when (boundp 'some-variable) 
   (message "some-variable is %s" some-variable))
;; ==> (boundp 'some-variable) ; 't
;; ==> some-variable is "less"

Whereas without a quote:

(when (boundp some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))
;; ==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.

Short answer

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 returns the value. In this case you need to provide the value of the symbol to the function. If no symbol var is bound, or the value is nil then it will return nil.

Explanation

For the manual definition please see the manual.

' and (quote ...) both perform the same purpose in emacs-lisp.

The purpose of this is to pass the unevaluated form to the surrounding environment rather than evaluate it.

In your example assume we had the following higher up

(setq some-variable "less") ;; Rather than just 't for clarity

Then the evaluation goes as follows:

(when (boundp 'some-variable) 
   (message "some-variable is %s" some-variable))
;; ==> (boundp 'some-variable) ; 't
;; ==> some-variable is "less"

Whereas without a quote:

(when (boundp some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))
;; ==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.

Made the code snippets syntactically correct + added some polishing around the snippets
Source Link

Short answer

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 returns the value. In this case you need to provide the value of the symbol to the function. If no symbol var is bound, or the value is nil then it will return nil.

Explanation

For the manual definition please see the manual.

' and (quote ...) both perform the same purpose in emacs-lisp.

The purpose of this is to pass the unevaluated form to the surrounding environment rather than evaluate it.

In your example assume we had the following higher up

(setq some-variable "less") ;; Rather than just 't for clarity

Then the followingevaluation goes as follows:

(when (boundp 'some-variable) 
   (message "some-variable is %s" some-variable))
;; ==> (boundp 'some-variable) ; 't
;; ==> some-variable is "less"

Keeping boundp for consistency.Whereas without a quote:

(when (boundp some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))
;; ==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.

Short answer

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 returns the value. In this case you need to provide the value of the symbol to the function. If no symbol var is bound, or the value is nil then it will return nil.

Explanation

For the manual definition please see the manual.

' and (quote ...) both perform the same purpose in emacs-lisp.

The purpose of this is to pass the unevaluated form to the surrounding environment rather than evaluate it.

In your example assume we had the following higher up

(setq some-variable "less") ;; Rather than just 't for clarity

Then the following

(when (boundp 'some-variable) 
   (message "some-variable is %s" some-variable))
==> (boundp 'some-variable) ; 't
==> some-variable is "less"

Keeping boundp for consistency.

(when (boundp some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))
==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.

Short answer

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.

Explanation

For the manual definition please see the manual.

' and (quote ...) both perform the same purpose in emacs-lisp.

The purpose of this is to pass the unevaluated form to the surrounding environment rather than evaluate it.

In your example assume we had the following higher up

(setq some-variable "less") ;; Rather than just 't for clarity

Then the evaluation goes as follows:

(when (boundp 'some-variable) 
   (message "some-variable is %s" some-variable))
;; ==> (boundp 'some-variable) ; 't
;; ==> some-variable is "less"

Whereas without a quote:

(when (boundp some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))
;; ==> (boundp "less") ; "less" is not a variable. -> Error

Lisp evaluates forms as they are reached, by quoting the form you prevent evaluation so that the actual variable (or list, or function name) is passed.

added 391 characters in body
Source Link
Loading
Source Link
Loading