Skip to content

Use defvar for ergo-program-path instead of defconst #12

@rpgoldman

Description

@rpgoldman

Describe the bug
defconst is used to define ergo-program-path; it's better to use defvar. defvar ensures that, if the variable has already been set (e.g., in a user's emacs init file), the value supplied in the defvar form will not overwrite the previous value.

defconst always evaluates value, and sets the value of symbol to the result

versus

If value is specified, and symbol is void (i.e., it has no dynamically bound value; see When a Variable is Void), then defvar evaluates value, and initializes symbol by setting it to the result of the evaluation. But if symbol is not void, defvar does not evaluate value, and leaves symbol’s value unchanged. If value is omitted, defvar doesn’t change the value of symbol in any case. [bold added]

defvar has this behavior specifically to enable users to set mode configuration variables before the mode is loaded.

If a PR is desired, I can provide one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions