Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well I can see a couple of problems with your code. Firstly, you are popping from your major mode list every time you pop from your minor mode list. Secondly, you are quoting your <code>(pop)</code> calls, which means you are not passing the values you want into <code>(add-hook)</code>.</p> <p>A while loop does not execute its body when the loop value is nil, so your second block of code doesn't produce <code>nil</code> via your <code>(message)</code> because it doesn't get that far. nil is simply the final value produced in that <code>(progn)</code>, being the eventual return value of the while loop when it encounters nil.</p> <p>You might want to check out the interactive debugging support in Emacs so that you can figure out what is actually happening if your code isn't behaving the way you expected. See:<br> <kbd>M-:</kbd> <code>(info "(elisp) debugging")</code> <kbd>RET</kbd></p> <p>However, I would suggest using lhui's solution rather than fixing what you have.</p> <p>For an alternative syntax, I use this approach:</p> <pre><code>(defun my-coding-config () (whitespace-mode 1) (yas/minor-mode 1)) (mapc (lambda (language-mode-hook) (add-hook language-mode-hook 'my-coding-config)) '(lisp-mode-hook rst-mode-hook python-mode-hook emacs-lisp-mode-hook text-mode-hook tcl-mode-hook c-mode-hook fortran-mode-hook)) </code></pre> <p>Defining a named function like <code>my-coding-config</code> simplifies things if you decide to include some new functionality later (such as including another minor mode) as you can make the change take immediate effect simply by re-evaluating that one function, rather than removing/adding items to all those hook variables.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload