* lisp: Prefer inlinable functions to macros.
* lisp/fringe.el (fringe-bitmap-p): Make it a plain function. * lisp/tooltip.el (tooltip-region-active-p): Remove. * lisp/net/shr.el (shr-char-breakable-p, shr-char-kinsoku-bol-p) (shr-char-kinsoku-eol-p, shr-char-nospace-p): Use define-inline. * lisp/url/url-future.el (url-future-done-p, url-future-completed-p) (url-future-errored-p, url-future-cancelled-p): * lisp/url/url-dav.el (url-dav-http-success-p): Use define-inline. * lisp/vc/ediff-init.el (ediff-odd-p): Remove. (ediff-background-face): Use cl-oddp instead. (ediff-buffer-live-p): Make it a defsubst.
This commit is contained in:
parent
887fa62285
commit
be307485f7
9 changed files with 48 additions and 32 deletions
|
@ -1,5 +1,16 @@
|
|||
2014-12-05 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* vc/ediff-init.el (ediff-odd-p): Remove.
|
||||
(ediff-background-face): Use cl-oddp instead.
|
||||
(ediff-buffer-live-p): Make it a defsubst.
|
||||
|
||||
* tooltip.el (tooltip-region-active-p): Remove.
|
||||
|
||||
* net/shr.el (shr-char-breakable-p, shr-char-kinsoku-bol-p)
|
||||
(shr-char-kinsoku-eol-p, shr-char-nospace-p): Use define-inline.
|
||||
|
||||
* fringe.el (fringe-bitmap-p): Make it a plain function.
|
||||
|
||||
* emacs-lisp/eieio-core.el: Prefer inlinable functions over macros.
|
||||
(class-p, generic-p, eieio-object-p, class-abstract-p):
|
||||
Make them defsubst, so as to avoid corner case problems where
|
||||
|
|
|
@ -3820,6 +3820,10 @@ that suppresses all warnings during execution of BODY."
|
|||
;; If things not being bound at all is ok, so must them being
|
||||
;; obsolete. Note that we add to the existing lists since Tramp
|
||||
;; (ab)uses this feature.
|
||||
;; FIXME: If `foo' is obsoleted by `bar', the code below
|
||||
;; correctly arranges to silence the warnings after testing
|
||||
;; existence of `foo', but the warning should also be
|
||||
;; silenced after testing the existence of `bar'.
|
||||
(let ((byte-compile-not-obsolete-vars
|
||||
(append byte-compile-not-obsolete-vars bound-list))
|
||||
(byte-compile-not-obsolete-funcs
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
(hollow-small . hollow-square))))
|
||||
|
||||
|
||||
(defmacro fringe-bitmap-p (symbol)
|
||||
(defun fringe-bitmap-p (symbol)
|
||||
"Return non-nil if SYMBOL is a fringe bitmap."
|
||||
`(get ,symbol 'fringe))
|
||||
|
||||
|
|
|
@ -412,25 +412,25 @@ size, and full-buffer size."
|
|||
(cdr (assq 'color shr-stylesheet))
|
||||
(cdr (assq 'background-color shr-stylesheet))))))))
|
||||
|
||||
(defmacro shr-char-breakable-p (char)
|
||||
(define-inline shr-char-breakable-p (char)
|
||||
"Return non-nil if a line can be broken before and after CHAR."
|
||||
`(aref fill-find-break-point-function-table ,char))
|
||||
(defmacro shr-char-nospace-p (char)
|
||||
(inline-quote (aref fill-find-break-point-function-table ,char)))
|
||||
(define-inline shr-char-nospace-p (char)
|
||||
"Return non-nil if no space is required before and after CHAR."
|
||||
`(aref fill-nospace-between-words-table ,char))
|
||||
(inline-quote (aref fill-nospace-between-words-table ,char)))
|
||||
|
||||
;; KINSOKU is a Japanese word meaning a rule that should not be violated.
|
||||
;; In Emacs, it is a term used for characters, e.g. punctuation marks,
|
||||
;; parentheses, and so on, that should not be placed in the beginning
|
||||
;; of a line or the end of a line.
|
||||
(defmacro shr-char-kinsoku-bol-p (char)
|
||||
(define-inline shr-char-kinsoku-bol-p (char)
|
||||
"Return non-nil if a line ought not to begin with CHAR."
|
||||
`(let ((char ,char))
|
||||
(and (not (eq char ?'))
|
||||
(aref (char-category-set char) ?>))))
|
||||
(defmacro shr-char-kinsoku-eol-p (char)
|
||||
(inline-letevals (char)
|
||||
(inline-quote (and (not (eq ,char ?'))
|
||||
(aref (char-category-set ,char) ?>)))))
|
||||
(define-inline shr-char-kinsoku-eol-p (char)
|
||||
"Return non-nil if a line ought not to end with CHAR."
|
||||
`(aref (char-category-set ,char) ?<))
|
||||
(inline-quote (aref (char-category-set ,char) ?<)))
|
||||
(unless (shr-char-kinsoku-bol-p (make-char 'japanese-jisx0208 33 35))
|
||||
(load "kinsoku" nil t))
|
||||
|
||||
|
|
|
@ -284,10 +284,6 @@ is based on the current syntax table."
|
|||
(when (> (point) start)
|
||||
(buffer-substring start (point)))))))
|
||||
|
||||
(defmacro tooltip-region-active-p ()
|
||||
"Value is non-nil if the region should override command actions."
|
||||
`(use-region-p))
|
||||
|
||||
(defun tooltip-expr-to-print (event)
|
||||
"Return an expression that should be printed for EVENT.
|
||||
If a region is active and the mouse is inside the region, print
|
||||
|
@ -295,7 +291,7 @@ the region. Otherwise, figure out the identifier around the point
|
|||
where the mouse is."
|
||||
(with-current-buffer (tooltip-event-buffer event)
|
||||
(let ((point (posn-point (event-end event))))
|
||||
(if (tooltip-region-active-p)
|
||||
(if (use-region-p)
|
||||
(when (and (<= (region-beginning) point) (<= point (region-end)))
|
||||
(buffer-substring (region-beginning) (region-end)))
|
||||
(tooltip-identifier-from-point point)))))
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2014-12-05 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* url-future.el (url-future-done-p, url-future-completed-p)
|
||||
(url-future-errored-p, url-future-cancelled-p):
|
||||
* url-dav.el (url-dav-http-success-p): Use define-inline.
|
||||
|
||||
2014-11-23 Lars Magne Ingebrigtsen <larsi@gnus.org>
|
||||
|
||||
* url-http.el (url-http): Respect `url-request-noninteractive'.
|
||||
|
|
|
@ -479,9 +479,9 @@ names (ie: DAV:resourcetype)."
|
|||
" <DAV:allprop/>")
|
||||
depth nil namespaces))
|
||||
|
||||
(defmacro url-dav-http-success-p (status)
|
||||
(define-inline url-dav-http-success-p (status)
|
||||
"Return whether STATUS was the result of a successful DAV request."
|
||||
`(= (/ (or ,status 500) 100) 2))
|
||||
(inline-quote (= (/ (or ,status 500) 100) 2)))
|
||||
|
||||
|
||||
;;; Locking support
|
||||
|
|
|
@ -44,17 +44,17 @@
|
|||
|
||||
(cl-defstruct url-future callback errorback status value)
|
||||
|
||||
(defmacro url-future-done-p (url-future)
|
||||
`(url-future-status ,url-future))
|
||||
(define-inline url-future-done-p (url-future)
|
||||
(inline-quote (url-future-status ,url-future)))
|
||||
|
||||
(defmacro url-future-completed-p (url-future)
|
||||
`(eq (url-future-status ,url-future) t))
|
||||
(define-inline url-future-completed-p (url-future)
|
||||
(inline-quote (eq (url-future-status ,url-future) t)))
|
||||
|
||||
(defmacro url-future-errored-p (url-future)
|
||||
`(eq (url-future-status ,url-future) 'error))
|
||||
(define-inline url-future-errored-p (url-future)
|
||||
(inline-quote (eq (url-future-status ,url-future) 'error)))
|
||||
|
||||
(defmacro url-future-cancelled-p (url-future)
|
||||
`(eq (url-future-status ,url-future) 'cancel))
|
||||
(define-inline url-future-cancelled-p (url-future)
|
||||
(inline-quote (eq (url-future-status ,url-future) 'cancel)))
|
||||
|
||||
(defun url-future-finish (url-future &optional status)
|
||||
(if (url-future-done-p url-future)
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
|
||||
;; Start compiler pacifier
|
||||
(defvar ediff-metajob-name)
|
||||
(defvar ediff-meta-buffer)
|
||||
|
@ -118,11 +120,8 @@ It needs to be killed when we quit the session.")
|
|||
(?C . ediff-buffer-C)))
|
||||
|
||||
;;; Macros
|
||||
(defmacro ediff-odd-p (arg)
|
||||
`(eq (logand ,arg 1) 1))
|
||||
|
||||
(defmacro ediff-buffer-live-p (buf)
|
||||
`(and ,buf (get-buffer ,buf) (buffer-name (get-buffer ,buf))))
|
||||
(defsubst ediff-buffer-live-p (buf)
|
||||
(and buf (get-buffer buf) (buffer-name (get-buffer buf))))
|
||||
|
||||
(defmacro ediff-get-buffer (arg)
|
||||
`(cond ((eq ,arg 'A) ediff-buffer-A)
|
||||
|
@ -1456,7 +1455,7 @@ This default should work without changes."
|
|||
;; The value of dif-num is always 1- the one that user sees.
|
||||
;; This is why even face is used when dif-num is odd.
|
||||
(ediff-get-symbol-from-alist
|
||||
buf-type (if (ediff-odd-p dif-num)
|
||||
buf-type (if (cl-oddp dif-num)
|
||||
ediff-even-diff-face-alist
|
||||
ediff-odd-diff-face-alist)
|
||||
))
|
||||
|
|
Loading…
Add table
Reference in a new issue