.dir-locals.el 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ;;; Directory Local Variables
  2. ;;; For more information see (info "(emacs) Directory Variables")
  3. ;; ((c++-mode
  4. ;; ;; (flycheck-gcc-language-standard . "gnu99")
  5. ;; (ps-landscape-mode . t)
  6. ;; (ps-paper-type . "letter")
  7. ;; (ps-number-of-columns . 2)
  8. ;; (;; Hard-wrap text automatically
  9. ;; auto-fill-mode . t)
  10. ;; (;; At what column to start right-aligned comments
  11. ;; comment-column . 30)
  12. ;; (;; Column to use for ‘comment-indent’. If nil, use ‘fill-column’ instead.
  13. ;; comment-fill-column . nil)
  14. ;; (;; Tell at what column to wrap left-aligned text
  15. ;; fill-column . 50)
  16. ;;
  17. ;; ;; (flycheck-clang-language-standard . "gnu99")
  18. ;; )
  19. ;;
  20. ;; ("src" . ((nil
  21. ;; .
  22. ;; (
  23. ;; (ps-landscape-mode . t)
  24. ;; (ps-paper-type . "letter")
  25. ;; (ps-number-of-columns . 2)
  26. ;; (comment-column . 50)
  27. ;; (comment-fill-column . 50)
  28. ;; (fill-column . 50)
  29. ;;
  30. ;; (compile-command . "if [ ! -d ../build ]; then mkdir ../build; fi; cd ../build && cmake .. && make")))))
  31. ;;
  32. ;; )
  33. ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html
  34. (
  35. ;; Default variables for all directories and modes
  36. (nil
  37. .
  38. (
  39. ;; (eval ;https://emacs.stackexchange.com/a/35965
  40. ;; . (progn
  41. ;; (with-temp-buffer ;https://stackoverflow.com/a/16789182
  42. ;; (call-process "bash" nil t nil "-c"
  43. ;; "source /opt/moose/environments/moose_profile; env")
  44. ;; (goto-char (point-min))
  45. ;; (while (not (eobp))
  46. ;; (setq process-environment
  47. ;; (cons (buffer-substring (point) (line-end-position))
  48. ;; process-environment))
  49. ;; (forward-line 1)))
  50. ;; ;; (setenv "METHOD" "dbg")
  51. ;; ))
  52. ))
  53. ;; Default variables for C mode in all directories
  54. (c-mode
  55. .
  56. ((mode ;https://stackoverflow.com/a/6912415
  57. .
  58. c++)
  59. (compile-command
  60. .
  61. (concat
  62. "source /opt/moose/environments/moose_profile && "
  63. "export CC=clang CXX=clang++ OMPI_MPICC=clang OMPI_CXX=clang++ LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 && make -j $MOOSE_JOBS -C ../; "
  64. ;; "LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 METHOD=dbg make -j $MOOSE_JOBS -C ../"
  65. ))
  66. ))
  67. ;; Default variables for C++ mode in all directories
  68. (c++-mode
  69. .
  70. ((compile-command
  71. .
  72. (concat
  73. "source /opt/moose/environments/moose_profile && "
  74. "export CC=clang CXX=clang++ OMPI_MPICC=clang OMPI_CXX=clang++ LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 && make -j $MOOSE_JOBS -C ../; "
  75. ;; "LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 METHOD=dbg make -j $MOOSE_JOBS -C ../"
  76. ))
  77. ))
  78. ;; Default variables for GetPot mode in all directories
  79. (getpot-mode
  80. .
  81. ((compile-command
  82. .
  83. (concat
  84. "source /opt/moose/environments/moose_profile && "
  85. ;; "mpirun -np $(lscpu | awk '/^CPU\\(s\\)/{print $2}')" ; set mpirun with max cpus
  86. "LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 mpirun -np $MOOSE_JOBS" ; set mpirun with max cpus
  87. " ../spider-opt -i " ;executable to use
  88. (if buffer-file-name
  89. (shell-quote-argument
  90. (buffer-file-name)))))))
  91. ;; Default variables for Gmsh mode in all directories
  92. (gmsh-mode
  93. .
  94. ((compile-command
  95. .
  96. (concat "gmsh -optimize_ho -format msh -3 -o "
  97. (if buffer-file-name
  98. (shell-quote-argument
  99. (file-name-sans-extension buffer-file-name)))
  100. ".msh "
  101. (if buffer-file-name
  102. (shell-quote-argument
  103. (buffer-file-name)))
  104. ))))
  105. )