Make chicken more ergonomic and remove dired previews
This commit is contained in:
parent
a75f9188f6
commit
ebbe94030f
2 changed files with 104 additions and 35 deletions
|
|
@ -89,36 +89,36 @@
|
|||
|
||||
|
||||
;; Preview files
|
||||
(defun dired-preview-to-the-right ()
|
||||
"My preferred `dired-preview-display-action-alist-function'."
|
||||
'((display-buffer-in-side-window)
|
||||
(side . right)
|
||||
(slot . 0)
|
||||
(window-width . 0.3)))
|
||||
;; (defun dired-preview-to-the-right ()
|
||||
;; "My preferred `dired-preview-display-action-alist-function'."
|
||||
;; '((display-buffer-in-side-window)
|
||||
;; (side . right)
|
||||
;; (slot . 0)
|
||||
;; (window-width . 0.3)))
|
||||
|
||||
(use-package dired-preview
|
||||
:after (ready-player)
|
||||
:config
|
||||
(setq dired-preview-display-action-alist #'dired-preview-to-the-right)
|
||||
(setq dired-preview-buffer-name-indicator "[Preview]")
|
||||
(setq dired-preview-ignored-extensions-regexp
|
||||
(concat "\\."
|
||||
"\\(gz\\|"
|
||||
"zst\\|"
|
||||
"tar\\|"
|
||||
"xz\\|"
|
||||
"rar\\|"
|
||||
"zip\\|"
|
||||
"iso\\|"
|
||||
"epub"
|
||||
"\\)"))
|
||||
(unless (equal system-type 'android) (dired-preview-global-mode 1)))
|
||||
;; (use-package dired-preview
|
||||
;; :after (ready-player)
|
||||
;; :config
|
||||
;; (setq dired-preview-display-action-alist #'dired-preview-to-the-right)
|
||||
;; (setq dired-preview-buffer-name-indicator "[Preview]")
|
||||
;; (setq dired-preview-ignored-extensions-regexp
|
||||
;; (concat "\\."
|
||||
;; "\\(gz\\|"
|
||||
;; "zst\\|"
|
||||
;; "tar\\|"
|
||||
;; "xz\\|"
|
||||
;; "rar\\|"
|
||||
;; "zip\\|"
|
||||
;; "iso\\|"
|
||||
;; "epub"
|
||||
;; "\\)"))
|
||||
;; (unless (equal system-type 'android) (dired-preview-global-mode 1)))
|
||||
|
||||
;; Automatically kill preview buffers when opening a file
|
||||
(add-hook 'find-file-hook (lambda ()
|
||||
(dolist (buf (buffer-list))
|
||||
(when (string-match-p "\\[Preview\\]" (buffer-name buf))
|
||||
(kill-buffer buf)))))
|
||||
;; ;; Automatically kill preview buffers when opening a file
|
||||
;; (add-hook 'find-file-hook (lambda ()
|
||||
;; (dolist (buf (buffer-list))
|
||||
;; (when (string-match-p "\\[Preview\\]" (buffer-name buf))
|
||||
;; (kill-buffer buf)))))
|
||||
|
||||
(use-package neotree
|
||||
:config
|
||||
|
|
|
|||
|
|
@ -42,16 +42,85 @@
|
|||
(setq inferior-lisp-program "sbcl"))
|
||||
|
||||
;; Scheme (with Chickens)
|
||||
(use-package geiser)
|
||||
(use-package geiser
|
||||
:config
|
||||
;; Auto-start the geiser repl
|
||||
(setq geiser-mode-start-repl-p t)
|
||||
|
||||
;; Put geiser in the bottom
|
||||
(add-to-list 'display-buffer-alist
|
||||
'("\\*Geiser .* REPL"
|
||||
(display-buffer-in-side-window)
|
||||
(side . bottom)
|
||||
(slot . 1)
|
||||
(window-height . 0.2)))
|
||||
(add-to-list 'display-buffer-alist
|
||||
`("\\*Geiser Documentation"
|
||||
(display-buffer-in-side-window)
|
||||
(side . ,(if (equal system-type 'android) 'bottom 'right))
|
||||
(slot . ,(if (equal system-type 'android) 0 3))
|
||||
(window-height . 0.2)))
|
||||
(add-to-list 'display-buffer-alist
|
||||
`("\\*Geiser Debug"
|
||||
(display-buffer-in-side-window)
|
||||
(side . ,(if (equal system-type 'android) 'bottom 'right))
|
||||
(slot . ,(if (equal system-type 'android) 0 4))
|
||||
(window-height . 0.2))))
|
||||
|
||||
(defcustom chicken-doc-repository ""
|
||||
"Custom location for the chicken-doc repository."
|
||||
:type 'string
|
||||
:group 'scheme
|
||||
:group 'geiser)
|
||||
|
||||
(use-package geiser-chicken
|
||||
:after (geiser)
|
||||
:config (add-to-list 'display-buffer-alist
|
||||
'("\\*Geiser"
|
||||
(display-buffer-in-side-window)
|
||||
(side . bottom)
|
||||
(slot . 1)
|
||||
(window-height . 0.2))))
|
||||
:config
|
||||
(setenv "CHICKEN_DOC_REPOSITORY" chicken-doc-repository)
|
||||
|
||||
;; Annoying BS to prevent inline C code from fucking with the syntax table
|
||||
;; This is really hacky and doesn't truly work properly especially with auto-indent
|
||||
(defun scheme-propertize-chicken-comment (start)
|
||||
"Find the matching <# for a #> at START and mark the whole region as a comment."
|
||||
(save-excursion
|
||||
(goto-char start)
|
||||
(let ((pos (point)))
|
||||
(if (re-search-forward "<#" nil t)
|
||||
(progn
|
||||
(put-text-property pos (point) 'syntax-table (string-to-syntax "< c"))
|
||||
(put-text-property pos (1+ pos) 'syntax-table (string-to-syntax "<"))
|
||||
(put-text-property (1- (point)) (point) 'syntax-table (string-to-syntax ">")))
|
||||
;; no matching <# found – maybe just mark the #> as invalid
|
||||
(put-text-property pos (1+ pos) 'syntax-table (string-to-syntax "'"))))))
|
||||
|
||||
(defun chicken-scheme-syntax-propertize (start end)
|
||||
"Extend scheme-syntax-propertize to also handle #> ... <#."
|
||||
(goto-char start)
|
||||
(funcall
|
||||
(syntax-propertize-rules
|
||||
("#>" (0 (ignore (scheme-propertize-chicken-comment (match-beginning 0)))))
|
||||
("<#" (0 (ignore (scheme-propertize-chicken-comment (match-beginning 0)))))
|
||||
)
|
||||
start end))
|
||||
|
||||
;; Replace the default scheme-syntax-propertize when chicken is being used
|
||||
(add-hook 'scheme-mode-hook
|
||||
(lambda ()
|
||||
(when (memq 'chicken geiser-active-implementations)
|
||||
(setq-local syntax-propertize-function #'chicken-scheme-syntax-propertize)
|
||||
(syntax-propertize (point-max)))))
|
||||
|
||||
;; Modifications for chicken
|
||||
;; Indent module contents at column 0
|
||||
(defun scheme-module-indent (state indent-point normal-indent) 0)
|
||||
(put 'module 'scheme-indent-function 'scheme-module-indent)
|
||||
|
||||
(put 'and-let* 'scheme-indent-function 1)
|
||||
(put 'parameterize 'scheme-indent-function 1)
|
||||
(put 'handle-exceptions 'scheme-indent-function 1)
|
||||
(put 'when 'scheme-indent-function 1)
|
||||
(put 'unless 'scheme-indent-function 1)
|
||||
(put 'match 'scheme-indent-function 1))
|
||||
|
||||
(use-package geiser-racket
|
||||
:after (geiser))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue