Skip to content

Commit

Permalink
refine for reducing compiled size
Browse files Browse the repository at this point in the history
  • Loading branch information
junjiemars committed Dec 30, 2024
1 parent 2915b26 commit c2bff79
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 34 deletions.
23 changes: 11 additions & 12 deletions config/thingatpts.el
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
(eval-when-compile
(defmacro unless-fn-thing-at-point-bounds-of-string-at-point% (&rest body)
(declare (indent 0))
`(if-fn% thing-at-point-bounds-of-string-at-point thingatpt
(comment ,@body)
,@body)))
(if-fn% thing-at-point-bounds-of-string-at-point thingatpt
`(comment ,@body)
`(progn% ,@body))))

(eval-when-compile
(defmacro unless-fn-thing-at-point-bounds-of-list-at-point% (&rest body)
(declare (indent 0))
`(if-fn% thing-at-point-bounds-of-list-at-point thingatpt
(comment ,@body)
,@body)))
(if-fn% thing-at-point-bounds-of-list-at-point thingatpt
`(comment ,@body)
`(progn% ,@body))))

(unless-fn-thing-at-point-bounds-of-string-at-point%
(defun thing-at-point-bounds-of-string-at-point ()
Expand Down Expand Up @@ -53,15 +53,14 @@

;; end of require

(defun on-thingatpt-init! ()
;;; fix wrong behavior on ancient Emacs.
(defun on-thingatpt-init! ()
(unless-fn-thing-at-point-bounds-of-string-at-point%
(put 'string 'bounds-of-thing-at-point
'thing-at-point-bounds-of-string-at-point))
(put 'string 'bounds-of-thing-at-point
'thing-at-point-bounds-of-string-at-point))
(unless-fn-thing-at-point-bounds-of-list-at-point%
(put 'list 'bounds-of-thing-at-point
'thing-at-point-bounds-of-list-at-point))

(put 'list 'bounds-of-thing-at-point
'thing-at-point-bounds-of-list-at-point))
(unless% (eq 'beginning-of-defun (get 'defun 'beginning-op))
(put 'defun 'beginning-op 'beginning-of-defun))
(unless% (eq 'end-of-defun (get 'defun 'end-op))
Expand Down
41 changes: 19 additions & 22 deletions config/xrefs.el
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,30 @@

;;; `xref-find-definitions' associated macro, since emacs25

(defmacro if-fn-xref-find-definitions% (then &rest body)
(declare (indent 1))
(if-fn 'xref-find-definitions 'xref
`,then
`(progn% ,@body)))

(defmacro when-fn-xref-find-definitions% (&rest body)
(declare (indent 0))
`(if-fn-xref-find-definitions%
(progn% ,@body)
(comment ,@body)))

(defmacro unless-fn-xref-find-definitions% (&rest body)
(declare (indent 0))
`(if-fn-xref-find-definitions%
(comment ,@body)
(progn% ,@body)))
(eval-when-compile
(defmacro when-fn-xref-find-definitions% (&rest body)
(declare (indent 0))
(if-fn% xref-find-definitions xref
`(progn% ,@body)
`(comment ,@body))))

(eval-when-compile
(defmacro unless-fn-xref-find-definitions% (&rest body)
(declare (indent 0))
(if-fn% xref-find-definitions xref
`(comment ,@body)
`(progn% ,@body))))

;; end of `xref-find-definitions' associated macro

;;; `xref--show-location' associated macro, since emacs25

(defmacro when-fn-xref--show-location% (&rest body)
(declare (indent 0))
(if-fn 'xref--show-location 'xref
`(progn% ,@body)
`(comment ,@body)))
(eval-when-compile
(defmacro when-fn-xref--show-location% (&rest body)
(declare (indent 0))
(if-fn% xref--show-location xref
`(progn% ,@body)
`(comment ,@body))))

;; end of `xref--show-location' associated macro

Expand Down

0 comments on commit c2bff79

Please sign in to comment.