Hi, thank you very much for helping me. ------------------------------------------------------ I did all of that you proposed. -------------------------------------------------------- and I can open the markdown-mode -------------------------------------------------------- but I get this message in opening emacs: Debugger entered--Lisp error: (void-function add-to-path) (add-to-path 'load-path "/home/gfp/.config/emacs/elpa/markdown-mode-2.5/") load-with-code-conversion("/home/gfp/.config/emacs/init.el" "/home/gfp/.config/emacs/init.el" t t) load("/home/gfp/.config/emacs/init" noerror nomessage) startup--load-user-init-file(#f(compiled-function () #) #f(compiled-function () #) t) command-line() normal-top-level() ------------------------------------------------------------- May be there is something wrong with my path? I put the "markdown.el" file, which I created, in the directory: markdown-mode-2.5 /home/gfp/.config/emacs/elpa/markdown-mode-2.5/") --------------------------------------------------------- So I don’t understand, why I get this error message. Kind regards Gottfried Am 23.02.23 um 21:17 schrieb Jean Louis: > It is better that you create some files where you put functions you > need, instead of putting everything in init.el > > You can create asciidoc.el file and put inside what is for > Asciidoc. Similar for markdown. > > Then in init.el you can put: > > (load "markdown.el") > (load "asciidoc.el") > > If your files are in some directory /my/directory, then you make sure > that Emacs can find them, to load them. > > (add-to-path 'load-path "/my/directory") > (load "markdown.el") > (load "asciidoc.el") > > or once you have this setting in init.el: > (add-to-path 'load-path "/my/directory") > > and you have got all your other files in that directory, you can load > files when you need by using M-: (load-file "markdown") > or by using `l' in Dired directory, or M-x load-file > > Even better is if you use packages or learn how to make them. That > will be most beneficial. > > And about setting up timers, I would rather set them up this way: > > ;; following is mimicing (run-with-timer SECS REPEAT FUNCTION &rest ARGS) > ;; by using the variable storing the values > (defvar my-timer '(1 5 my-function)) > > Then I could have this function to simply toggle the timer: > > (defun rcd-toggle-timer (symbol) > "Toggle global SYMBOL timer as TRUE or FALSE." > (cond ((boundp symbol) > (cond ((and (nth 3 (symbol-value symbol)) > (timerp (nth 3 (symbol-value symbol)))) > (cancel-timer (nth 3 (symbol-value symbol))) > (setf (symbol-value symbol) > (list (nth 0 (symbol-value symbol)) > (nth 1 (symbol-value symbol)) > (nth 2 (symbol-value symbol))))) > ((and (not (nth 3 (symbol-value symbol))) > (nth 2 (symbol-value symbol))) > (setf (symbol-value symbol) > (list > (nth 0 (symbol-value symbol)) > (nth 1 (symbol-value symbol)) > (nth 2 (symbol-value symbol)) > (run-with-timer > (nth 0 (symbol-value symbol)) > (nth 1 (symbol-value symbol)) > (nth 2 (symbol-value symbol)))))) > (t (message "Could not set up timer `%s'" symbol))) > (symbol-value symbol)) > (t (user-error "Cannot setup timer `%s'" symbol)))) > > And then I apply the function: > > (rcd-toggle-timer 'my-timer) > > Then for automatic preview: > > (defvar my-timer '(1 5 my-preview-function)) > > (defun toggle-markdown-preview () > (interactive) > (rcd-toggle-timer 'my-timer)) > > Then I could invoke it as command: > > M-x toggle-markdown-preview > > and then timer toggles, it turns on or turns off. > > Then you could hold your variable with the timer and timer function in separate file, it need not be init.el and you load it when you need it. > --