works well, particularly after custom defining additional file type pairs with

(defvar my-cpp-other-file-alist '(("\\.cpp\\'" (".hpp" ".cuh"))
                                  ("\\.hpp\\'" (".cpp"".cu"))
                                  ("\\.cuh\\'" (".cu" ".cpp"))
                                  ("\\.cu\\'" (".cuh" ".hpp"))
                                  ("\\.c\\'" (".h"))
                                  ("\\.h\\'" (".c"))))

(setq-default ff-other-file-alist 'my-cpp-other-file-alist)

However, it does not switch files when point in on include directive in c/cpp files. What is the setting to always ignore the content under point in this context?

1 Answer 1


M-x describe-function RET ff-find-other-file gives the necessary info. There is custom variable ff-ignore-include which should control this, however it seems like it has no effect...

ff-find-other-file also has an ignore-include argument and with that it seems to work. So you could use something like:

(defun my-ff-find-other-file ()
  (ff-find-other-file nil t))
  • I know of this variable, it does not work as expected though
    – CD86
    Jan 2, 2023 at 16:54
  • Strange. Does it work when you use the ignore-include argument of ff-find-other-file directly then?
    – orgtre
    Jan 2, 2023 at 16:57
  • by directly you mean invoking it via M-x?
    – CD86
    Jan 3, 2023 at 13:06
  • I've updated my answer to explain.
    – orgtre
    Jan 3, 2023 at 15:04
  • Looking at the code of ff-find-other-file explains that, as it calls (let ((ff-ignore-include ignore-include)) (ff-find-the-other-file in-other-window)) using its ignore-include argument (which is always nil for interactive calls). In fact all three commands in that library force the value of ff-ignore-include, as ff-get-other-file binds it to t and ff-find-other-file-other-window calls ff-find-other-file with the ignore-include argument set to nil. I suggest M-x report-emacs-bug to improve the documentation about this.
    – phils
    Sep 30, 2023 at 22:17

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.