A number of various updates, some cool, most boring.
[syinit] / 12-misc.el
index ae83b36..2248841 100644 (file)
@@ -5,7 +5,7 @@
 ;;     Author: Steve Youngs <steve@sxemacs.org>
 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
 ;;    Created: <2007-12-02>
-;; Time-stamp: <Saturday Apr 18, 2020 21:07:03 steve>
+;; Time-stamp: <Thursday 08 Apr 2021 10:52:03 (steve)>
 ;;   Download: <https://downloads.sxemacs.org/SYinits>
 ;;   HTMLised: <https://www.sxemacs.org/SYinits/12-misc.html>
 ;;   Git Repo: git clone https://git.sxemacs.org/syinit
 ;:* Time-Stamp
 (require 'time-stamp)
 (add-hook 'write-file-hooks 'time-stamp)
-(set 'time-stamp-active t)
-(set 'time-stamp-format "%a %3b %2d, %4y %02H:%02M:%02S %u")
-
+(setq time-stamp-active t)
+(setq time-stamp-format "%a %02d %3b %4y %02H:%02M:%02S (%u)")
 ;:*======================
 ;:* Image formats
 (require 'image-mode)
 ;; XPM files for example.  Have you seen xpm-mode? it's awesome.
 ;(Wand-find-file-enable)
 ;; But sometimes you do want it so...
-(global-set-key [(super ?x) (super ?f)] #'Wand-display)
+;; [2021-02-15] My ImageMagick is currently dead
+;(global-set-key [(super ?x) (super ?f)] #'Wand-display)
 
 ;:*=======================
 ;:* ffi-magic
 (setq dired-tar-compress-with 'xz)
 
 ;; FFI/libWand for image files in Dired
-(defun sy-dired-wand ()
- (interactive)
- (let ((file (dired-get-filename)))
-   (Wand-display file)))
-
-(define-key dired-mode-map [?b] #'sy-dired-wand)
+;; [2021-02-15] My ImageMagick is currently dead
+;(defun sy-dired-wand ()
+; (interactive)
+; (let ((file (dired-get-filename)))
+;   (Wand-display file)))
+;
+;(define-key dired-mode-map [?b] #'sy-dired-wand)
 
 ;; Play audio files directly from dired.
 (defun sy-dired-play-audio ()
 (when (featurep 'mule)
   (add-to-list 'file-coding-system-alist '("\\.procmailrc$" . binary)))
 
+;:*=======================
+;:* Ninja mode (just some font-locking)
+;;
+;; I just took what worked from ninja-mode.el in the ninja source and
+;; dumped it here with some minor massaging.
+(defvar ninja-font-lock-keywords)
+
+(define-derived-mode ninja-mode fundamental-mode "ninja"
+  "Major mode for a bit of font-locking in ninja files."
+  (setq comment-start "#")
+  (setq comment-start-skip "#[ \t]*")
+  (setq ninja-font-lock-keywords
+         `((,(concat "^" (regexp-opt '("rule" "build" "subninja" "include"
+                                       "pool" "default")
+                                     'words))
+            . font-lock-keyword-face)
+           ("\\([[:alnum:]_]+\\) =" 1 font-lock-variable-name-face)
+           ;; Variable expansion.
+           ("$[[:alnum:]_]+" . font-lock-variable-name-face)
+           ("${[[:alnum:]._]+}" . font-lock-variable-name-face)
+           ;; Rule names
+           ("rule +\\([[:alnum:]_.-]+\\)" 1 font-lock-function-name-face)
+           ;; Build Statement - highlight the rule used,
+           ;; allow for escaped $,: in outputs.
+           ("build +\\(?:[^:$\n]\\|$[:$]\\)+ *: *\\([[:alnum:]_.-]+\\)"
+            1 font-lock-function-name-face)
+           ("^#.*$" . font-lock-comment-face)))
+  (font-lock-mode))
+
+(add-to-list 'auto-mode-alist '("\\.ninja$" . ninja-mode))
+
+;:*=======================
+;:* Meson / CMake
+;;
+;; There exists both a meson-mode and a cmake-mode but they are very
+;; GNU/Emacs only and I haven't yet been able to get either to behave
+;; in SXEmacs. These next two aliases will at least let me open meson
+;; and cmake files that have the mode set via local cookie.
+(defalias 'meson-mode 'fundamental-mode)
+(defalias 'cmake-mode 'fundamental-mode)
+
 ;:*======================
 ;:* Build Reports
 (setq
 (require 'google-query)
 (setq google-query-mirror "https://www.google.com.au"
       google-query-result-count 100)
-(global-set-key [(control f9)] 'google-query)
-(global-set-key [(meta f9)] 'google-query-region)
+(global-set-key [XF86Search] 'google-query)
+(global-set-key [(control XF86Search)] 'google-query-region)
 
 ;:*=======================
 ;:* What the fuck does that acronym mean?