1

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?

dalanicolai
  • 7,795
  • 8
  • 24
CD86
  • 563
  • 2
  • 11

1 Answers1

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 ()
  (interactive)
  (ff-find-other-file nil t))
orgtre
  • 1,072
  • 4
  • 16
  • I know of this variable, it does not work as expected though – CD86 Jan 02 '23 at 16:54
  • Strange. Does it work when you use the ignore-include argument of ff-find-other-file directly then? – orgtre Jan 02 '23 at 16:57
  • by directly you mean invoking it via M-x? – CD86 Jan 03 '23 at 13:06
  • I've updated my answer to explain. – orgtre Jan 03 '23 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 '23 at 22:17
  • As such, the suggested custom command in this answer looks like the right way to go. – phils Sep 30 '23 at 22:22