about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-05-15 17:30:04 -0500
committerCase Duckworth2023-05-15 17:30:04 -0500
commit9ce43429943d1f4ef2ad743bdc9798abafc31826 (patch)
treefcceb5373d5524973d769cec5144a7dca1e645c9
parentFix weird stuff from org-mouse.el (diff)
downloadetc-9ce43429943d1f4ef2ad743bdc9798abafc31826.tar.gz
etc-9ce43429943d1f4ef2ad743bdc9798abafc31826.zip
Rip off use-package's `autoload-keymap' thing
-rw-r--r--emacs.el178
1 files changed, 104 insertions, 74 deletions
diff --git a/emacs.el b/emacs.el index f466b83..e9e658c 100644 --- a/emacs.el +++ b/emacs.el
@@ -22,6 +22,25 @@
22 22
23;;; Definitions: 23;;; Definitions:
24 24
25(defmacro autoload-keymap (keymap library &optional parent-keymap)
26 "Require LIBRARY to load KEYMAP-SYMBOL, then press the buttons again.
27This rips off `use-package-autoload-keymap' basically."
28 `(defun ,(intern (format "autoload-keymap-" keymap)) ()
29 (interactive)
30 (unless (featurep ',library)
31 (require ',(cond
32 ((symbolp library)
33 library)
34 ((stringp library)
35 (intern library))
36 (t (user-error "LIBRARY should be a symbol or string: %s"
37 library))))
38 (let ((kv (this-command-keys-vector)))
39 (define-key ,(or parent-keymap (current-global-map)) kv ,keymap)
40 (setq unread-command-events
41 (mapcar (lambda (ev) (cons t ev))
42 (listify-key-sequence kv)))))))
43
25(defun renz/sort-by-alpha-length (elems) 44(defun renz/sort-by-alpha-length (elems)
26 "Sort ELEMS first alphabetically, then by length." 45 "Sort ELEMS first alphabetically, then by length."
27 (sort elems (lambda (c1 c2) 46 (sort elems (lambda (c1 c2)
@@ -361,84 +380,95 @@ If REQUIRE is a non-nil value, require the package after adding it."
361 380
362;;; Jabber 381;;; Jabber
363 382
364(use-package jabber 383(ensure-package 'jabber t)
365 :load-path "~/src/jabber.el" 384(add-to-list 'load-path
366 :defer t 385 (expand-file-name "jabber-fallback-lib"
367 :bind-keymap (("C-c j" . jabber-global-keymap)) 386 "~/src/jabber.el/"))
368 :preface nil 387
369 (setq-default jabber-chat-buffer-format "*%n*" 388(setopt jabber-chat-buffer-format "*%n*")
370 jabber-browse-buffer-format "*%n*" 389(setopt jabber-browse-buffer-format "*%n*")
371 jabber-groupchat-buffer-format "*%n*" 390(setopt jabber-groupchat-buffer-format "*%n*")
372 jabber-muc-private-buffer-format "*%n*") 391(setopt jabber-muc-private-buffer-format "*%n*")
373 :custom-face 392
374 (jabber-activity-face ((t :inherit jabber-chat-prompt-foreign 393(face-spec-set 'jabber-activity-face
375 :foreground unspecified 394 '((t :inherit jabber-chat-prompt-foreign
376 :weight normal))) 395 :foreground unspecified
377 (jabber-activity-personal-face ((t :inherit jabber-chat-prompt-local 396 :weight normal)))
378 :foreground unspecified 397(face-spec-set 'jabber-activity-personal-face
379 :weight bold))) 398 '((t :inherit jabber-chat-prompt-local
380 (jabber-chat-prompt-local ((t :inherit minibuffer-prompt 399 :foreground unspecified
381 :foreground unspecified 400 :weight bold)))
382 :weight normal 401(face-spec-set 'jabber-chat-prompt-local
383 :slant italic))) 402 '((t :inherit minibuffer-prompt
384 (jabber-chat-prompt-foreign ((t :inherit warning 403 :foreground unspecified
385 :foreground unspecified 404 :weight normal
386 :weight normal))) 405 :slant italic)))
387 (jabber-chat-prompt-system ((t :inherit font-lock-doc-face 406(face-spec-set 'jabber-chat-prompt-foreign
388 :foreground unspecified))) 407 '((t :inherit warning
389 (jabber-rare-time-face ((t :inherit font-lock-comment-face 408 :foreground unspecified
390 :foreground unspecified 409 :weight normal)))
391 :underline nil))) 410(face-spec-set 'jabber-chat-prompt-system
392 :config 411 '((t :inherit font-lock-doc-face
412 :foreground unspecified)))
413(face-spec-set 'jabber-rare-time-face
414 '((t :inherit font-lock-comment-face
415 :foreground unspecified
416 :underline nil)))
417
418(setopt jabber-auto-reconnect t)
419(setopt jabber-last-read-marker "~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~")
420(setopt jabber-muc-decorate-presence-patterns
421 '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$" . nil)
422 ("Mode #.*" . jabber-muc-presence-dim)
423 ("." . jabber-muc-presence-dim)))
424(setopt jabber-activity-make-strings #'jabber-activity-make-strings-shorten)
425(setopt jabber-rare-time-format
426 (format " - - - - - %%H:%d %%F"
427 (let ((min (string-to-number (format-time-string "%M"))))
428 (* 5 (floor min 5)))))
429(setopt jabber-muc-header-line-format '(" " jabber-muc-topic))
430
431(setopt jabber-groupchat-prompt-format "%n. ")
432(setopt jabber-chat-local-prompt-format "%n. ")
433(setopt jabber-chat-foreign-prompt-format "%n. ")
434(setopt jabber-muc-private-foreign-prompt-format "%g/%n. ")
435
436(keymap-global-set "C-c C-SPC" #'jabber-activity-switch-to)
437(with-eval-after-load 'jabber
393 (require 'jabber-httpupload nil t) 438 (require 'jabber-httpupload nil t)
394 (setopt jabber-auto-reconnect t
395 jabber-last-read-marker "~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~"
396 jabber-muc-decorate-presence-patterns
397 '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$" . nil)
398 ("Mode #.*" . jabber-muc-presence-dim)
399 ("." . jabber-muc-presence-dim))
400 jabber-activity-make-strings #'jabber-activity-make-strings-shorten
401 jabber-rare-time-format
402 (format " - - - - - %%H:%d %%F"
403 (let ((min (string-to-number (format-time-string "%M"))))
404 (* 5 (floor min 5))))
405 jabber-muc-header-line-format '(" " jabber-muc-topic))
406
407 (setopt jabber-groupchat-prompt-format "%n. "
408 jabber-chat-local-prompt-format "%n. "
409 jabber-chat-foreign-prompt-format "%n. "
410 jabber-muc-private-foreign-prompt-format "%g/%n. ")
411
412 (keymap-global-set "C-c C-SPC" #'jabber-activity-switch-to)
413 (map-keymap (lambda (key command) 439 (map-keymap (lambda (key command)
414 (define-key jabber-global-keymap (vector (+ key #x60)) command)) 440 (define-key jabber-global-keymap (vector (+ key #x60)) command))
415 jabber-global-keymap) 441 jabber-global-keymap)
416 (keymap-global-set "C-x C-j" #'dired-jump) 442 (keymap-global-set "C-x C-j" #'dired-jump))
417 443
418 (add-hook 'jabber-post-connect-hooks #'jabber-enable-carbons) 444(keymap-global-set "C-c j" (autoload-keymap jabber-global-keymap jabber))
419 (remove-hook 'jabber-alert-muc-hooks 'jabber-muc-echo) 445(keymap-global-set "C-x C-j" #'dired-jump)
420 (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo) 446
421 (add-hook 'jabber-chat-mode-hook 'visual-line-mode) 447(add-hook 'jabber-post-connect-hooks #'jabber-enable-carbons)
422 (add-hook 'jabber-chat-mode-hook (defun jabber-no-position () 448(remove-hook 'jabber-alert-muc-hooks 'jabber-muc-echo)
423 (setq-local mode-line-position nil))) 449(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)
424 (add-hook 'jabber-activity-mode-hook 450(add-hook 'jabber-chat-mode-hook 'visual-line-mode)
425 (defun jabber-activity-no-global-mode () 451
426 (setq global-mode-string 452(add-hook 'jabber-chat-mode-hook
427 (delete '(t jabber-activity-mode-string) 453 (defun jabber-no-position ()
428 global-mode-string)))) 454 (setq-local mode-line-position nil)))
429 455(add-hook 'jabber-activity-mode-hook
430 (add-hook 'jabber-alert-muc-hooks 456 (defun jabber-activity-no-global-mode ()
431 (defun jabber@highlight-acdw (&optional _ _ buf _ _) 457 (setq global-mode-string
432 (when buf 458 (delete '(t jabber-activity-mode-string)
433 (with-current-buffer buf 459 global-mode-string))))
434 (let ((regexp (rx word-boundary 460(add-hook 'jabber-alert-muc-hooks
435 "acdw" ; maybe get from the config? 461 (defun jabber@highlight-acdw (&optional _ _ buf _ _)
436 word-boundary))) 462 (when buf
437 (hi-lock-unface-buffer regexp) 463 (with-current-buffer buf
438 (highlight-regexp regexp 'jabber-chat-prompt-local)))))) 464 (let ((regexp (rx word-boundary
439 465 "acdw" ; maybe get from the config?
440 (when (fboundp 'jabber-chat-update-focus) 466 word-boundary)))
441 (add-hook 'window-configuration-change-hook #'jabber-chat-update-focus))) 467 (hi-lock-unface-buffer regexp)
468 (highlight-regexp regexp 'jabber-chat-prompt-local))))))
469
470(when (fboundp 'jabber-chat-update-focus)
471 (add-hook 'window-configuration-change-hook #'jabber-chat-update-focus))
442 472
443 473
444;;; Configuration: 474;;; Configuration: