knowhy / icinga2-mode

Emacs major mode for editing icinga2 configuration files
GNU General Public License v3.0
3 stars 0 forks source link

Symbol's value as variable is void: icinga2-mode-map #1

Open JanSimek opened 3 years ago

JanSimek commented 3 years ago

Hello, I added this to my init.el:

;; Tell emacs where is your personal elisp lib dir                                           
(add-to-list 'load-path "~/.emacs.d/lisp/")                                                  

;; load the packaged named xyz.                                                              
(load "icinga2-mode") ;; best not to include the ending .el or .elc

But when I start emacs I am getting this error:

Symbol's value as variable is void: icinga2-mode-map

To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the `--debug-init' option to view a complete error backtrace.

Starting with --debug-init:

Debugger entered--Lisp error: (void-variable icinga2-mode-map)
  (define-key icinga2-mode-map [remap comment-dwim] 'icinga2-comment-dwim)
  (let ((map (make-keymap))) (define-key map "\n" 'newline-and-indent) (define-key icinga2-mode-map [remap comment-dwim] 'icinga2-comment-dwim) (define-key map "M-TAB" 'icinga2-complete-s$
  (defvar icinga2-mode-map (let ((map (make-keymap))) (define-key map "\n" 'newline-and-indent) (define-key icinga2-mode-map [remap comment-dwim] 'icinga2-comment-dwim) (define-key map "M$
  eval-buffer(#<buffer  *load*-569621> nil "/home/jsimek/.emacs.d/lisp/icinga2-mode.el" nil t)  ; Reading at buffer position 7799
  load-with-code-conversion("/home/jsimek/.emacs.d/lisp/icinga2-mode.el" "/home/jsimek/.emacs.d/lisp/icinga2-mode.el" nil nil)
  load("icinga2-mode")
  eval-buffer(#<buffer  *load*> nil "/home/jsimek/.emacs.d/init.el" nil t)  ; Reading at buffer position 1073
  load-with-code-conversion("/home/jsimek/.emacs.d/init.el" "/home/jsimek/.emacs.d/init.el" t t)
  load("/home/jsimek/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x158f95839631>) #f(compiled-function () #<bytecode 0x158f95839645>) t)
  command-line()
  normal-top-level()
JanSimek commented 3 years ago

There is no error when I comment-out this part:

;;(defvar icinga2-mode-map
;;  (let ((map (make-keymap)))
;;    (define-key map "\C-j" 'newline-and-indent)
;;    (define-key icinga2-mode-map [remap comment-dwim] 'icinga2-comment-dwim)
;;    (define-key map "M-TAB" 'icinga2-complete-symbol)
;;    map)
;;  "Keymap for icinga2 major mode")
knowhy commented 2 years ago

https://github.com/knowhy/icinga2-mode/commit/cb6482d3e4652d39e58413c58ad53ed2a53360ba should resolve this. Basic tab completion for keywords should work now.