I'm running into an order of initialization issue with hooks.

  • prog-mode-hook enables fci-mode
  • rust-mode-hook sets the fci-rule-column to 99.
  • on initial display the fill column shows at 80 (it's original value), moving the cursor redraws at 99.

This is not really a question about fci-mode, the solution is to set fci-rule-column before starting fci-mode (after or at the end of the rust-mode-hook).

To avoid needing to add generic code into all my programming mode hooks:

Is there a way to run a generic prog-mode-hook after more specialized hooks run?

2 Answers 2


You can use after-change-major-mode-hook:

(add-hook 'after-change-major-mode-hook 'my-after-change-major-mode-prog-mode)
(defun my-after-change-major-mode-prog-mode ()
  "Custom `after-change-major-mode-hook' behaviours."
  (when (derived-mode-p 'prog-mode)

Refer to https://stackoverflow.com/a/19295380 for more details on the sequence of events when derived modes run.


Here's another option:

(defun my-prog-mode-hook ()
  (when (derived-mode-p 'rust-mode)
    (setq fci-rule-column 99))
  (fci-mode 1))
(add-hook 'prog-mode-hook #'my-prog-mode-hook)
  • This works too, I just wanted to keep all my rust options in one place instead of scattered all over the file.
    – ideasman42
    Feb 25, 2018 at 22:29
  • Indeed, the best choice depends on whether you prefer to keep all your Rust settings in one place or if you prefer to keep all your fci settings in one place.
    – Stefan
    Feb 26, 2018 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.