improve fez/flash-region, remove string syntax highlighting

This commit is contained in:
opfez 2021-06-13 12:11:06 +02:00
parent 18cae6b35b
commit 271a5cedb6
3 changed files with 19 additions and 3 deletions

View File

@ -28,14 +28,25 @@
(beginning-of-line)
(looking-at-p "[[:space:]]*$")))
(defun fez/current-line-comment-p ()
"Checks if the current line is a commented out one or not."
(save-excursion
(beginning-of-line)
(let ((a (point)))
(end-of-line)
(let ((b (point)))
(comment-only-p a b)))))
(defun fez/flash-region (&optional timeout)
"Temporarily highlight region from START to END. Taken from SLIME source code and modified."
(interactive)
(transient-mark-mode)
(save-excursion
(mark-defun)
;; Don't mark the line above the s-expression.
(while (fez/current-line-empty-p)
;; Don't mark the line or the comments above the s-expression.
(while (or (fez/current-line-empty-p)
(fez/current-line-comment-p))
;; Can probably be optimized...
(forward-char))
(let* ((start (region-beginning))
(end (region-end))
@ -93,6 +104,8 @@
;;; Keybinds
;; C-x C-z and C-z are normally mapped to suspend-frame, an absolutely useless function.
;; Unbind them before making the keybind useful.
(global-unset-key (kbd "C-x C-z"))

View File

@ -142,7 +142,7 @@
(font-lock-preprocessor-face (:foreground fg))
(font-lock-regexp-grouping-backslash (:foreground fg))
(font-lock-regexp-grouping-construct-face (:foreground fg))
(font-lock-string-face (:foreground c9))
(font-lock-string-face (:foreground fg))
(font-lock-reference-face (:foreground fg))
(font-lock-type-face (:foreground fg))
(font-lock-variable-name-face (:foreground fg))

View File

@ -14,6 +14,9 @@
(horizontal-scroll-bars . nil))))
(add-hook 'after-make-frame-functions 'my/disable-scroll-bars)
;; Disable startup screen
(setq inhibit-startup-screen t)
;; Make sure UTF-8 is used.
(set-language-environment "UTF-8")