emacs: is before-save-hook a local variable?

前端 未结 5 1398
陌清茗
陌清茗 2021-01-02 04:11

how would I figure this out?

I added delete-trailing-whitespace to the before-save-hook in my c-mode-common-hook, but it loo

5条回答
  •  执笔经年
    2021-01-02 04:19

    Never wanted to do this before, but this should work:

    (set (make-local-variable 'before-save-hook) '((lambda() (rg-msg "foobie")))) 
    

    In general C-h v will prompt for a variable name and display a description telling you whether the var is buffer-local.

    before-save-hook is a variable defined in `files.el'. Its value is nil

    This variable is potentially risky when used as a file local variable.

    Documentation: Normal hook that is run before a buffer is saved to its file.

    You can customize this variable.

    vs.

    next-error-function is a variable defined in `simple.el'. Its value is nil

    Automatically becomes buffer-local when set in any fashion. This variable is potentially risky when used as a file local variable.

    Documentation: Function to use to find the next error in the current buffer. The function is called with 2 parameters:

    [...]

提交回复
热议问题