| 
									
										
										
										
											2019-11-28 20:08:44 +01:00
										 |  |  | ;;; .dir-locals.el | 
					
						
							|  |  |  | ;; | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  | ;; Per-Directory Local Variables: | 
					
						
							|  |  |  | ;;   https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html | 
					
						
							| 
									
										
										
										
											2019-11-28 20:08:44 +01:00
										 |  |  | ;; | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  | ;; For full fledge developer tools install emacs packages: | 
					
						
							| 
									
										
										
										
											2019-11-28 20:08:44 +01:00
										 |  |  | ;; | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  | ;;    M-x package-install ... | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  | ;; | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  | ;;     magit gitconfig | 
					
						
							|  |  |  | ;;     nvm lsp-mode lsp-pyright lsp-eslint | 
					
						
							|  |  |  | ;;     pyvenv pylint pip-requirements | 
					
						
							|  |  |  | ;;     jinja2-mode | 
					
						
							|  |  |  | ;;     json-mode | 
					
						
							|  |  |  | ;;     company company-jedi company-quickhelp company-shell | 
					
						
							|  |  |  | ;;     realgud | 
					
						
							|  |  |  | ;;     sphinx-doc markdown-mode graphviz-dot-mode | 
					
						
							|  |  |  | ;;     apache-mode nginx-mode | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  | ;; | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  | ;; To setup a developer environment, build target:: | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  | ;; | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  | ;;     $ make node.env.dev pyenv.install | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  | ;; | 
					
						
							|  |  |  | ;; Some buffer locals are referencing the project environment: | 
					
						
							| 
									
										
										
										
											2019-11-28 20:08:44 +01:00
										 |  |  | ;; | 
					
						
							|  |  |  | ;; - prj-root                                --> <repo>/ | 
					
						
							| 
									
										
										
										
											2021-11-20 15:21:35 +01:00
										 |  |  | ;; - nvm-dir                                 --> <repo>/.nvm | 
					
						
							| 
									
										
										
										
											2019-11-28 20:08:44 +01:00
										 |  |  | ;; - python-environment-directory            --> <repo>/local | 
					
						
							|  |  |  | ;; - python-environment-default-root-name    --> py3 | 
					
						
							|  |  |  | ;; - python-shell-virtualenv-root            --> <repo>/local/py3 | 
					
						
							|  |  |  | ;;       When this variable is set with the path of the virtualenv to use, | 
					
						
							|  |  |  | ;;      `process-environment' and `exec-path' get proper values in order to run | 
					
						
							|  |  |  | ;;      shells inside the specified virtualenv, example:: | 
					
						
							|  |  |  | ;;         (setq python-shell-virtualenv-root "/path/to/env/") | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  | ;; - python-shell-interpreter                --> <repo>/local/py3/bin/python | 
					
						
							| 
									
										
										
										
											2019-11-28 20:08:44 +01:00
										 |  |  | ;; | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  | ;; Python development: | 
					
						
							|  |  |  | ;; | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  | ;; Jedi, flycheck & other python stuff should use the 'python-shell-interpreter' | 
					
						
							|  |  |  | ;; from the local py3 environment. | 
					
						
							| 
									
										
										
										
											2019-11-28 20:08:44 +01:00
										 |  |  | ;; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ((nil | 
					
						
							|  |  |  |   . ((fill-column . 80) | 
					
						
							| 
									
										
										
										
											2021-05-17 20:13:16 +02:00
										 |  |  |      (indent-tabs-mode . nil) | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  |      (eval . (progn | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-23 13:54:08 +01:00
										 |  |  |                (add-to-list 'auto-mode-alist '("\\.html\\'" . jinja2-mode)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  |                ;; project root folder is where the `.dir-locals.el' is located | 
					
						
							|  |  |  |                (setq-local prj-root | 
					
						
							|  |  |  |                            (locate-dominating-file  default-directory ".dir-locals.el")) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                (setq-local python-environment-directory | 
					
						
							|  |  |  |                            (expand-file-name "./local" prj-root)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-27 17:01:00 +02:00
										 |  |  |                ;; to get in use of NVM environment, install https://github.com/rejeep/nvm.el | 
					
						
							| 
									
										
										
										
											2021-11-20 15:21:35 +01:00
										 |  |  |                (setq-local nvm-dir (expand-file-name "./.nvm" prj-root)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  |                ;; use nodejs from the (local) NVM environment (see nvm-dir) | 
					
						
							|  |  |  |                (nvm-use-for-buffer) | 
					
						
							|  |  |  |                (ignore-errors (require 'lsp)) | 
					
						
							|  |  |  |                (setq-local lsp-server-install-dir (car (cdr nvm-current-version))) | 
					
						
							|  |  |  |                (setq-local lsp-enable-file-watchers nil) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-27 17:01:00 +02:00
										 |  |  |                ;; use 'py3' environment as default | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  |                (setq-local python-environment-default-root-name | 
					
						
							|  |  |  |                            "py3") | 
					
						
							| 
									
										
										
										
											2021-06-05 17:42:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  |                (setq-local python-shell-virtualenv-root | 
					
						
							|  |  |  |                            (expand-file-name | 
					
						
							|  |  |  |                             python-environment-default-root-name python-environment-directory)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                (setq-local python-shell-interpreter | 
					
						
							|  |  |  |                            (expand-file-name | 
					
						
							|  |  |  |                             "bin/python" python-shell-virtualenv-root)))))) | 
					
						
							| 
									
										
										
										
											2021-06-05 17:42:06 +02:00
										 |  |  |  (makefile-gmake-mode | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  |   . ((indent-tabs-mode . t))) | 
					
						
							| 
									
										
										
										
											2021-06-05 17:42:06 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |  (yaml-mode | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  |   . ((eval . (progn | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                ;; flycheck should use the local py3 environment | 
					
						
							|  |  |  |                (setq-local flycheck-yaml-yamllint-executable | 
					
						
							|  |  |  |                            (expand-file-name "bin/yamllint" python-shell-virtualenv-root)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                (setq-local flycheck-yamllintrc | 
					
						
							|  |  |  |                            (expand-file-name  ".yamllint.yml" prj-root)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                (flycheck-checker . yaml-yamllint))))) | 
					
						
							| 
									
										
										
										
											2021-06-05 17:42:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-22 17:46:46 +02:00
										 |  |  |  (json-mode | 
					
						
							|  |  |  |   . ((eval . (progn | 
					
						
							| 
									
										
										
										
											2021-11-23 18:08:46 +01:00
										 |  |  |                (setq-local js-indent-level 4) | 
					
						
							| 
									
										
										
										
											2021-06-22 17:46:46 +02:00
										 |  |  |                (flycheck-checker . json-python-json))))) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-24 12:12:13 +02:00
										 |  |  |  (js-mode | 
					
						
							|  |  |  |   . ((eval . (progn | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  |                (ignore-errors (require 'lsp-eslint)) | 
					
						
							| 
									
										
										
										
											2021-06-24 12:12:13 +02:00
										 |  |  |                (setq-local js-indent-level 2) | 
					
						
							| 
									
										
										
										
											2022-01-24 11:34:34 +01:00
										 |  |  |                ;; flycheck should use the eslint checker from developer tools | 
					
						
							|  |  |  |                (setq-local flycheck-javascript-eslint-executable | 
					
						
							|  |  |  |                            (expand-file-name "node_modules/.bin/eslint" prj-root)) | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  |                ;; (flycheck-mode) | 
					
						
							| 
									
										
										
										
											2022-01-24 11:34:34 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  |                (if (featurep 'lsp-eslint) | 
					
						
							|  |  |  |                    (lsp)) | 
					
						
							| 
									
										
										
										
											2021-06-24 12:12:13 +02:00
										 |  |  |                )))) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-05 17:42:06 +02:00
										 |  |  |  (python-mode | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  |   . ((eval . (progn | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  |                (ignore-errors (require 'jedi-core)) | 
					
						
							|  |  |  |                (ignore-errors (require 'lsp-pyright)) | 
					
						
							|  |  |  |                (ignore-errors (sphinx-doc-mode)) | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  |                (setq-local python-environment-virtualenv | 
					
						
							|  |  |  |                            (list (expand-file-name "bin/virtualenv" python-shell-virtualenv-root) | 
					
						
							|  |  |  |                                  ;;"--system-site-packages" | 
					
						
							|  |  |  |                                  "--quiet")) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                (setq-local pylint-command | 
					
						
							|  |  |  |                            (expand-file-name "bin/pylint" python-shell-virtualenv-root)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-28 18:34:33 +02:00
										 |  |  |                (if (featurep 'lsp-pyright) | 
					
						
							|  |  |  |                    (lsp)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-11 16:50:53 +02:00
										 |  |  |                ;; pylint will find the '.pylintrc' file next to the CWD | 
					
						
							|  |  |  |                ;;   https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options | 
					
						
							|  |  |  |                (setq-local flycheck-pylintrc | 
					
						
							|  |  |  |                            ".pylintrc") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                ;; flycheck & other python stuff should use the local py3 environment | 
					
						
							|  |  |  |                (setq-local flycheck-python-pylint-executable | 
					
						
							|  |  |  |                            python-shell-interpreter) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                ;; use 'M-x jedi:show-setup-info' and 'M-x epc:controller' to inspect jedi server | 
					
						
							|  |  |  |                ;; https://tkf.github.io/emacs-jedi/latest/#jedi:environment-root -- You | 
					
						
							|  |  |  |                ;; can specify a full path instead of a name (relative path). In that case, | 
					
						
							|  |  |  |                ;; python-environment-directory is ignored and Python virtual environment | 
					
						
							|  |  |  |                ;; is created at the specified path. | 
					
						
							|  |  |  |                (setq-local jedi:environment-root | 
					
						
							|  |  |  |                            python-shell-virtualenv-root) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                ;; https://tkf.github.io/emacs-jedi/latest/#jedi:server-command | 
					
						
							|  |  |  |                (setq-local jedi:server-command | 
					
						
							|  |  |  |                            (list python-shell-interpreter | 
					
						
							|  |  |  |                                  jedi:server-script)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                ;; jedi:environment-virtualenv --> see above 'python-environment-virtualenv' | 
					
						
							|  |  |  |                ;; is set buffer local!  No need to setup jedi:environment-virtualenv: | 
					
						
							|  |  |  |                ;; | 
					
						
							|  |  |  |                ;;    Virtualenv command to use.  A list of string.  If it is nil, | 
					
						
							|  |  |  |                ;;    python-environment-virtualenv is used instead.  You must set non-nil | 
					
						
							|  |  |  |                ;;    value to jedi:environment-root in order to make this setting work. | 
					
						
							|  |  |  |                ;; | 
					
						
							|  |  |  |                ;;    https://tkf.github.io/emacs-jedi/latest/#jedi:environment-virtualenv | 
					
						
							|  |  |  |                ;; | 
					
						
							|  |  |  |                ;; (setq-local jedi:environment-virtualenv | 
					
						
							|  |  |  |                ;;             (list (expand-file-name "bin/virtualenv" python-shell-virtualenv-root) | 
					
						
							|  |  |  |                ;;                   "--python" | 
					
						
							|  |  |  |                ;;                   "/usr/bin/python3.4" | 
					
						
							|  |  |  |                ;;                   )) | 
					
						
							|  |  |  |                )))) | 
					
						
							|  |  |  |  ) |