Skip to content

Commit

Permalink
XXX: Trying to upgrade to Emacs 28
Browse files Browse the repository at this point in the history
  • Loading branch information
ubolonton committed Apr 17, 2022
1 parent 6bb40a5 commit 450c3c1
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 76 deletions.
135 changes: 60 additions & 75 deletions config/ublt-dvorak.el
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@
:config
(setq-default
;; We don't use :custom, since this is dynamically set based on whether we are in a GUI.
hydra-hint-display-type (if (memq window-system '(mac ns)) 'posframe 'lv)
hydra-hint-display-type (if (and (memq window-system '(mac ns))
(version< emacs-version "28"))
'posframe 'lv)
hydra-posframe-show-params
(list :internal-border-width 1
:poshandler #'posframe-poshandler-point-bottom-left-corner))
Expand All @@ -443,32 +445,15 @@
(append `(:internal-border-color ,(face-attribute 'mode-line :background))
`(:background-color ,(face-attribute 'hl-line :background))
hydra-posframe-show-params)))
(apply f args))))

(defhydra ublt/hydra-avy (:exit t :hint nil)
"
^Line^ ^Region^ ^Goto^
^^^^^^^^──────────────────────────────────────────
_y_ yank _Y_ yank _c_ 2 chars _C_ char
_m_ move _M_ move _w_ word _W_ any word
_k_ kill _K_ kill _l_ line _L_ end of line
"
("c" avy-goto-char-2)
("C" avy-goto-char)
("w" avy-goto-word-1)
("W" avy-goto-word-0)
("l" avy-goto-line)
("L" avy-goto-end-of-line)
("m" avy-move-line)
("M" avy-move-region)
("k" avy-kill-whole-line)
("K" avy-kill-region)
("y" avy-copy-line)
("Y" avy-copy-region))


(defhydra ublt/hydra-info (:hint nil :color teal)
"
(apply f args)))

(define-advice ublt/hydra-help/body (:around (f &rest args) ublt/center)
(let ((hydra-posframe-show-params (append '(:poshandler posframe-poshandler-frame-center)
hydra-posframe-show-params)))
(apply f args)))

(defhydra ublt/hydra-info (:hint nil :color teal)
"
Search ^^ Open manual ^^
^^^^^^───────────────────────────────────────────────────
_e_ elisp _C-e_ elisp _C-v_ evil
Expand All @@ -480,28 +465,28 @@
[_h_] helm doc [_C-i_] all info
"
("e" helm-info-elisp)
("o" helm-info-org)
("g" helm-info-magit)
("r" helm-info-emacs)
("s" info-lookup-symbol)
("l" helm-info-cl)

("C-e" (info "elisp"))
("C-o" (info "org"))
("G" (info "magit"))
("C-r" info-emacs-manual)
("C-l" (info "cl"))
("C-u" (info "use-package"))

("C-v" (info "evil"))
("C-t" (info "transient"))

("C-i" info)
("h" helm-documentation))

(defhydra ublt/hydra-help (:hint nil :color teal)
"
("e" helm-info-elisp)
("o" helm-info-org)
("g" helm-info-magit)
("r" helm-info-emacs)
("s" info-lookup-symbol)
("l" helm-info-cl)

("C-e" (info "elisp"))
("C-o" (info "org"))
("G" (info "magit"))
("C-r" info-emacs-manual)
("C-l" (info "cl"))
("C-u" (info "use-package"))

("C-v" (info "evil"))
("C-t" (info "transient"))

("C-i" info)
("h" helm-documentation))

(defhydra ublt/hydra-help (:hint nil :color teal)
"
Describe ^^ Keys ^^ Go to ^^ Docs ^^
^^^^^^^^────────────────────────────────────────────────────────────────
_f_ function _k_ brief key _C-f_ function _C-i_ info
Expand All @@ -513,32 +498,32 @@
^^ ^^ _C-u_ config
[_C-h_] use built-in help [_l_] view lossage
"
("f" helpful-callable)
("c" helpful-command)
("v" helpful-variable)
("s" helpful-symbol)
("m" describe-mode)
("o" helpful-at-point)
("p" describe-package)

("k" describe-key-briefly)
("K" helpful-key)
("w" where-is)
("b" describe-bindings)

("C-f" find-function)
("C-v" find-variable)
("C-k" find-function-on-key)
("C-l" find-library)
("C-o" find-function-at-point)
("C-u" use-package-jump-to-package-form)
("F" find-face-definition)

("C-i" ublt/hydra-info/body)
("C-w" helm-man-woman)

("C-h" help-for-help)
("l" view-lossage))
("f" helpful-callable)
("c" helpful-command)
("v" helpful-variable)
("s" helpful-symbol)
("m" describe-mode)
("o" helpful-at-point)
("p" describe-package)

("k" describe-key-briefly)
("K" helpful-key)
("w" where-is)
("b" describe-bindings)

("C-f" find-function)
("C-v" find-variable)
("C-k" find-function-on-key)
("C-l" find-library)
("C-o" find-function-at-point)
("C-u" use-package-jump-to-package-form)
("F" find-face-definition)

("C-i" ublt/hydra-info/body)
("C-w" helm-man-woman)

("C-h" help-for-help)
("l" view-lossage)))

(use-package which-key
:disabled
Expand Down
1 change: 1 addition & 0 deletions config/ublt-editing.el
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ See `http://ergoemacs.org/emacs/modernization_upcase-word.html'

;;; Copy/cut/duplicate whole line if no region is selected
(use-package whole-line-or-region
:disabled (version<= "28" emacs-version)
:config (defun ublt/duplicate-line (_)
(interactive "p")
;; FIX: This looks dirty
Expand Down
3 changes: 3 additions & 0 deletions config/ublt-helm.el
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
:fuzzy-match t))))))

(use-package helm-for-files
;; XXX
:init (when (version<= "28" emacs-version)
(setq browse-url-mosaic-program "xmosaic"))
:ensure nil :straight nil
:custom ((helm-ff-file-name-history-use-recentf t)
;; helm-ff-auto-update-initial-value t
Expand Down
1 change: 1 addition & 0 deletions config/ublt-programming.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
(use-package cc-mode
:mode ("\\.m$" . objc-mode))


(use-package tree-sitter
:demand t
:hook (tree-sitter-after-on . tree-sitter-hl-mode)
Expand Down
38 changes: 38 additions & 0 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,44 @@
(defvar ublt/packages
'(use-package))

;;; XXX: Breaking change in Emacs 28. This doesn't work though.
(when (version<= "28" emacs-version)
(eval-and-compile
(defmacro define-obsolete-function-alias (obsolete-name current-name
&optional when docstring)
"Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete.
\(define-obsolete-function-alias \\='old-fun \\='new-fun \"28.1\" \
\"old-fun's doc.\")
is equivalent to the following two lines of code:
\(defalias \\='old-fun \\='new-fun \"old-fun's doc.\")
\(make-obsolete \\='old-fun \\='new-fun \"28.1\")
WHEN should be a string indicating when the function was first
made obsolete, for example a date or a release number.
See the docstrings of `defalias' and `make-obsolete' for more details."
(declare (doc-string 4))
`(progn
(defalias ,obsolete-name ,current-name ,docstring)
(make-obsolete ,obsolete-name ,current-name ,(or when "2022-04-17"))))))

;; XXX: New load suffix for dynamic module is `.dylib', but `autoload' has not been updated.
;;
;; error: tsc-dyn.dylib:0:0: error: scan-error: (Containing expression ends prematurely 57524 57525)
(when (version<= "28" emacs-version)
(defun ublt/-remove-dylib-suffixes (suffixes)
(cl-remove-if (lambda (s) (string-match-p "dylib" s))
suffixes))

(define-advice make-directory-autoloads (:around (f &rest args) ublt/ignore-dylib)
(advice-add 'get-load-suffixes :filter-return #'ublt/-remove-dylib-suffixes)
(unwind-protect
(apply f args)
(advice-remove 'get-load-suffixes #'ublt/-remove-dylib-suffixes))))

(pcase (getenv "EMACS_PACKAGE_MANAGER")
("package.el"
(progn
Expand Down
2 changes: 1 addition & 1 deletion straight/versions/default.el
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
("volatile-highlights.el" . "9a20091f0ce7fc0a6b3e641a6a46d5f3ac4d8392")
("wat-mode" . "f34fc84879a99130283a124cd196041b474213e1")
("web-mode" . "b286d682205f86b7fe878a92a5afb510a07cd132")
("whole-line-or-region" . "15f17488f98868f1628a3f9d91a812b1f89bc73a")
("whole-line-or-region" . "500ad90695e8a5a0cefabb7500158eab0835a0ce")
("with-editor" . "7e0bf753709f1775d2bbbb6edf4482fca7fd286a")
("yaml-mode" . "40067a10ac1360f0b9533f0bbbb2eea128e2574d")
("yasnippet" . "fc33b2fbaee6c514c91e80f5b1c0210c776b03ed")
Expand Down

0 comments on commit 450c3c1

Please sign in to comment.