.dir-locals.el: Assert default GNU settings.
* .dir-locals.el: Assert default GNU settings.
This commit is contained in:
parent
757bea68fd
commit
c66abfb83c
143
.dir-locals.el
143
.dir-locals.el
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Mes --- Maxwell Equations of Software
|
;;; GNU Mes --- Maxwell Equations of Software
|
||||||
;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
;;; Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Mes.
|
;;; This file is part of GNU Mes.
|
||||||
;;;
|
;;;
|
||||||
|
@ -16,73 +16,20 @@
|
||||||
;;; You should have received a copy of the GNU General Public License
|
;;; You should have received a copy of the GNU General Public License
|
||||||
;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
((nil
|
;; The GNU project defaults. These are also the GNU Emacs defaults.
|
||||||
.
|
;; Re-asserting theme here, however, as a courtesy for setups that use
|
||||||
((indent-tabs-mode . nil)
|
;; a global override.
|
||||||
(eval
|
(
|
||||||
.
|
;; For writing GNU C code, see
|
||||||
(progn
|
;; https://www.gnu.org/prep/standards/html_node/Writing-C.html
|
||||||
(let ((top (locate-dominating-file default-directory ".dir-locals.el"))))
|
(c-mode . ((c-file-style . "gnu")
|
||||||
|
(indent-tabs-mode . nil)))
|
||||||
|
|
||||||
(defun guile--manual-look-up (id mod)
|
(makefile-mode . ((indent-tabs-mode . t)))
|
||||||
(message "guile--manual-look-up id=%s => %s mod=%s" id (symbol-name id) mod)
|
|
||||||
(let ((info-lookup-other-window-flag
|
|
||||||
geiser-guile-manual-lookup-other-window-p))
|
|
||||||
(info-lookup-symbol (symbol-name id) 'scheme-mode))
|
|
||||||
(when geiser-guile-manual-lookup-other-window-p
|
|
||||||
(switch-to-buffer-other-window "*info*"))
|
|
||||||
(search-forward (format "%s" id) nil t))
|
|
||||||
|
|
||||||
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
|
(nil . ((indent-tabs-mode . nil)
|
||||||
|
(fill-column . 72)))
|
||||||
|
|
||||||
(defun guix-switch-profile (&optional profile)
|
|
||||||
"reset Emacs' environment by snarfing PROFILE/etc/profile"
|
|
||||||
|
|
||||||
(defun matches-in-string (regexp string)
|
|
||||||
"return a list of matches of REGEXP in STRING."
|
|
||||||
(let ((matches))
|
|
||||||
(save-match-data
|
|
||||||
(string-match "^" "")
|
|
||||||
(while (string-match regexp string (match-end 0))
|
|
||||||
(push (or (match-string 1 string) (match-string 0 string)) matches)))
|
|
||||||
matches))
|
|
||||||
|
|
||||||
(interactive "fprofile: ")
|
|
||||||
(let* ((output (shell-command-to-string (concat "GUIX_PROFILE= /bin/sh -x " profile "/etc/profile")))
|
|
||||||
(exports (matches-in-string "^[+] export \\(.*\\)" output)))
|
|
||||||
(mapcar (lambda (line) (apply #'setenv (split-string line "="))) exports )))
|
|
||||||
|
|
||||||
(defun shell-args-to-string (&rest args)
|
|
||||||
(shell-command-to-string (mapconcat 'identity args " ")))
|
|
||||||
|
|
||||||
(defun as (string &optional arch)
|
|
||||||
(let* ((arch (or arch "--64"))
|
|
||||||
(asm (subst-char-in-string ?_ ?\s string))
|
|
||||||
(foo (message "asm:%S" asm))
|
|
||||||
(result (shell-args-to-string "as" arch (concat "<(echo '" asm "')")))
|
|
||||||
(disassembly (shell-args-to-string "objdump" "-d" "a.out"))
|
|
||||||
(foo (message "disassembly: %S" disassembly))
|
|
||||||
(match (string-match "^ 0:[\t]\\([^\t]*\\)" disassembly))
|
|
||||||
(code (match-string 1 disassembly))
|
|
||||||
(code (apply 'concat (split-string code " " t))))
|
|
||||||
(insert " ")
|
|
||||||
(insert code)))
|
|
||||||
|
|
||||||
(defun as-32 (point mark)
|
|
||||||
(interactive "r")
|
|
||||||
(let* ((string (buffer-substring point mark))
|
|
||||||
(code (as string "--32")))
|
|
||||||
(insert " ")
|
|
||||||
(insert code)))
|
|
||||||
|
|
||||||
(defun as-64 (point mark)
|
|
||||||
(interactive "r")
|
|
||||||
(let* ((string (buffer-substring point mark))
|
|
||||||
(code (as string "--64")))
|
|
||||||
(insert " ")
|
|
||||||
(insert code)))))))
|
|
||||||
(makefile-mode
|
|
||||||
(indent-tabs-mode . t))
|
|
||||||
(scheme-mode
|
(scheme-mode
|
||||||
.
|
.
|
||||||
((geiser-active-implementations . (guile))
|
((geiser-active-implementations . (guile))
|
||||||
|
@ -96,5 +43,69 @@
|
||||||
(mapcar
|
(mapcar
|
||||||
#'prefix-dir-locals-dir
|
#'prefix-dir-locals-dir
|
||||||
'("scripts" "module")))))))
|
'("scripts" "module")))))))
|
||||||
|
|
||||||
(texinfo-mode . ((indent-tabs-mode . nil)
|
(texinfo-mode . ((indent-tabs-mode . nil)
|
||||||
(fill-column . 72))))
|
(fill-column . 72)))
|
||||||
|
(nil .
|
||||||
|
((eval
|
||||||
|
.
|
||||||
|
(progn
|
||||||
|
(let ((top (locate-dominating-file default-directory ".dir-locals.el"))))
|
||||||
|
|
||||||
|
(defun guile--manual-look-up (id mod)
|
||||||
|
(message "guile--manual-look-up id=%s => %s mod=%s" id (symbol-name id) mod)
|
||||||
|
(let ((info-lookup-other-window-flag
|
||||||
|
geiser-guile-manual-lookup-other-window-p))
|
||||||
|
(info-lookup-symbol (symbol-name id) 'scheme-mode))
|
||||||
|
(when geiser-guile-manual-lookup-other-window-p
|
||||||
|
(switch-to-buffer-other-window "*info*"))
|
||||||
|
(search-forward (format "%s" id) nil t))
|
||||||
|
|
||||||
|
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
|
||||||
|
|
||||||
|
(defun guix-switch-profile (&optional profile)
|
||||||
|
"reset Emacs' environment by snarfing PROFILE/etc/profile"
|
||||||
|
|
||||||
|
(defun matches-in-string (regexp string)
|
||||||
|
"return a list of matches of REGEXP in STRING."
|
||||||
|
(let ((matches))
|
||||||
|
(save-match-data
|
||||||
|
(string-match "^" "")
|
||||||
|
(while (string-match regexp string (match-end 0))
|
||||||
|
(push (or (match-string 1 string) (match-string 0 string)) matches)))
|
||||||
|
matches))
|
||||||
|
|
||||||
|
(interactive "fprofile: ")
|
||||||
|
(let* ((output (shell-command-to-string (concat "GUIX_PROFILE= /bin/sh -x " profile "/etc/profile")))
|
||||||
|
(exports (matches-in-string "^[+] export \\(.*\\)" output)))
|
||||||
|
(mapcar (lambda (line) (apply #'setenv (split-string line "="))) exports )))
|
||||||
|
|
||||||
|
(defun shell-args-to-string (&rest args)
|
||||||
|
(shell-command-to-string (mapconcat 'identity args " ")))
|
||||||
|
|
||||||
|
(defun as (string &optional arch)
|
||||||
|
(let* ((arch (or arch "--64"))
|
||||||
|
(asm (subst-char-in-string ?_ ?\s string))
|
||||||
|
(foo (message "asm:%S" asm))
|
||||||
|
(result (shell-args-to-string "as" arch (concat "<(echo '" asm "')")))
|
||||||
|
(disassembly (shell-args-to-string "objdump" "-d" "a.out"))
|
||||||
|
(foo (message "disassembly: %S" disassembly))
|
||||||
|
(match (string-match "^ 0:[\t]\\([^\t]*\\)" disassembly))
|
||||||
|
(code (match-string 1 disassembly))
|
||||||
|
(code (apply 'concat (split-string code " " t))))
|
||||||
|
(insert " ")
|
||||||
|
(insert code)))
|
||||||
|
|
||||||
|
(defun as-32 (point mark)
|
||||||
|
(interactive "r")
|
||||||
|
(let* ((string (buffer-substring point mark))
|
||||||
|
(code (as string "--32")))
|
||||||
|
(insert " ")
|
||||||
|
(insert code)))
|
||||||
|
|
||||||
|
(defun as-64 (point mark)
|
||||||
|
(interactive "r")
|
||||||
|
(let* ((string (buffer-substring point mark))
|
||||||
|
(code (as string "--64")))
|
||||||
|
(insert " ")
|
||||||
|
(insert code))))))))
|
||||||
|
|
Loading…
Reference in a new issue