While editing code blocks with
org-mode by pressing C-c ' I'd like Flycheck to resolve relevant configuration
.jshintrc files within the same ancestry.
To be more specific, I'd like the
.jshintrc settings to be picked up while editing code if I had my project arranged like this:
This doesn't work, but is my ideal behavior.
The following setup works:
But it's not desirable because it sets defaults across all my projects.
I'm not sure if the following solutions are good ideas, and I'm unsure how implement them:
buffer-file-nameof local buffer when editing source code blocks in
Add another function to
Looking at the Flycheck source, my "lame solution" works because Flycheck looks at the home directory in case other attempts to look up the configuration fail. This behavior is defined by
flycheck-locate-config-file-ancestor-directories looks like the function I'd like to succeed in finding the configuration file. It looks like this:
(defun flycheck-locate-config-file-ancestor-directories (filename _checker) "Locate a configuration FILENAME in ancestor directories. If the current buffer has a file name, search FILENAME in the directory of the current buffer and all ancestors thereof (see `locate-dominating-file'). If the file is found, return its absolute path. Otherwise return nil. _CHECKER is ignored." (-when-let* ((basefile (buffer-file-name)) (directory (locate-dominating-file basefile filename))) (expand-file-name filename directory)))
buffer-file-name is set to an appropriate value we should be good. So what is its value for my code buffer?
nil. OK, so what are the effects of setting this variable locally for Org code buffers (and how do I do this whenever I enter from
org-mode with C-c ')?
Also, if I add my own look-up function to
flycheck-locate-config-file-functions, that may solve the problem. But how would I resolve the directory of the current
A simpler solution is welcome as well.