emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/nginx-mode 47aaf2c 29/34: Remove `run-hook`, it is run aut


From: ELPA Syncer
Subject: [nongnu] elpa/nginx-mode 47aaf2c 29/34: Remove `run-hook`, it is run automatically.
Date: Sun, 29 Aug 2021 11:24:17 -0400 (EDT)

branch: elpa/nginx-mode
commit 47aaf2c9a0beb0a530430b9c12ec148af6a2bd88
Author: Matus Goljer <dota.keys@gmail.com>
Commit: GitHub <noreply@github.com>

    Remove `run-hook`, it is run automatically.
    
    Hi.
    
    When using `define-derived-mode` one doesn't need (and shouldn't) use 
`run-hook` because the macro adds the form `run-mode-hook` itself when expanded 
(use macroexpand to check!).
    
    This results in the hook being called twice, see
    
    ```elisp
    (defun my-nginx-mode-init ()
      (message "Hello"))
    (add-hook 'nginx-mode-hook 'my-nginx-mode-init)
    ```
    
    In messages I have
    
        Hello [2 times]
    
    Simply removing the form and using the one provided by the macro is enough 
to fix this.
---
 nginx-mode.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/nginx-mode.el b/nginx-mode.el
index 9cf79e2..b038532 100644
--- a/nginx-mode.el
+++ b/nginx-mode.el
@@ -184,8 +184,7 @@ The variable nginx-indent-level controls the amount of 
indentation.
   (set (make-local-variable 'paragraph-separate) "\\([         \f]*\\|#\\)$")
 
   (set (make-local-variable 'font-lock-defaults)
-       '(nginx-font-lock-keywords nil))
-  (run-hooks 'nginx-mode-hook))
+       '(nginx-font-lock-keywords nil)))
 
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("nginx\\.conf\\'"  . nginx-mode))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]