New answers tagged

1

(defun my-dired-mode-hook () "Custom behaviours for `dired-mode'." ;; `truncate-lines' is automatically buffer-local. (setq truncate-lines t)) (add-hook 'dired-mode-hook #'my-dired-mode-hook)


1

For a minor mode, you can do: ... (setq foo-local-minor-mode nil) (error "Unable to set up Foo local minor mode") For a major mode it's a bit different: there's basically no such thing as "removing" a major mode, the only thing you can hope to do is to go back to the previous major mode (but that requires saving it beforehand) or switch to some "bare" ...


1

No, the mode has already done a whole bunch of stuff before your error happens. Use M-x pp-macroexpand-last-sexp to see what your definitions expand to, and where your mode body code actually runs. If you want to prevent a mode from being enabled, the logic needs to be in the place which tries to enable the mode. Alternatively, you can add some before ...


1

The O.P. has indicated in a comment underneath the original question that a previous suggestion by this author resolved the issue, and this answer is a write-up of that solution.... There is no need to use any advice-.... Instead, the O.P. could use one of two potential conditions: For just one exception, modify the function line-change as follows: (...


Top 50 recent answers are included