aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2014-12-05 12:49:53 -0500
committerStefan Monnier2014-12-05 12:49:53 -0500
commitbe307485f722be57985da979296fa37569c2a5a9 (patch)
treecff6ceeab51e5efc0825e5a8558bad4025ca6fdd /lisp
parent887fa622851c7db45ccacedb1c88e13e27be5d26 (diff)
downloademacs-be307485f722be57985da979296fa37569c2a5a9.tar.gz
emacs-be307485f722be57985da979296fa37569c2a5a9.zip
* 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/emacs-lisp/bytecomp.el4
-rw-r--r--lisp/fringe.el2
-rw-r--r--lisp/net/shr.el20
-rw-r--r--lisp/tooltip.el6
-rw-r--r--lisp/url/ChangeLog6
-rw-r--r--lisp/url/url-dav.el4
-rw-r--r--lisp/url/url-future.el16
-rw-r--r--lisp/vc/ediff-init.el11
9 files changed, 48 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 54e0804e4f4..2c6c377dfce 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,16 @@
12014-12-05 Stefan Monnier <monnier@iro.umontreal.ca> 12014-12-05 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * vc/ediff-init.el (ediff-odd-p): Remove.
4 (ediff-background-face): Use cl-oddp instead.
5 (ediff-buffer-live-p): Make it a defsubst.
6
7 * tooltip.el (tooltip-region-active-p): Remove.
8
9 * net/shr.el (shr-char-breakable-p, shr-char-kinsoku-bol-p)
10 (shr-char-kinsoku-eol-p, shr-char-nospace-p): Use define-inline.
11
12 * fringe.el (fringe-bitmap-p): Make it a plain function.
13
3 * emacs-lisp/eieio-core.el: Prefer inlinable functions over macros. 14 * emacs-lisp/eieio-core.el: Prefer inlinable functions over macros.
4 (class-p, generic-p, eieio-object-p, class-abstract-p): 15 (class-p, generic-p, eieio-object-p, class-abstract-p):
5 Make them defsubst, so as to avoid corner case problems where 16 Make them defsubst, so as to avoid corner case problems where
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index d6163f27e1d..e0cdd33c13d 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -3820,6 +3820,10 @@ that suppresses all warnings during execution of BODY."
3820 ;; If things not being bound at all is ok, so must them being 3820 ;; If things not being bound at all is ok, so must them being
3821 ;; obsolete. Note that we add to the existing lists since Tramp 3821 ;; obsolete. Note that we add to the existing lists since Tramp
3822 ;; (ab)uses this feature. 3822 ;; (ab)uses this feature.
3823 ;; FIXME: If `foo' is obsoleted by `bar', the code below
3824 ;; correctly arranges to silence the warnings after testing
3825 ;; existence of `foo', but the warning should also be
3826 ;; silenced after testing the existence of `bar'.
3823 (let ((byte-compile-not-obsolete-vars 3827 (let ((byte-compile-not-obsolete-vars
3824 (append byte-compile-not-obsolete-vars bound-list)) 3828 (append byte-compile-not-obsolete-vars bound-list))
3825 (byte-compile-not-obsolete-funcs 3829 (byte-compile-not-obsolete-funcs
diff --git a/lisp/fringe.el b/lisp/fringe.el
index ff60804cb19..97a03936080 100644
--- a/lisp/fringe.el
+++ b/lisp/fringe.el
@@ -83,7 +83,7 @@
83 (hollow-small . hollow-square)))) 83 (hollow-small . hollow-square))))
84 84
85 85
86(defmacro fringe-bitmap-p (symbol) 86(defun fringe-bitmap-p (symbol)
87 "Return non-nil if SYMBOL is a fringe bitmap." 87 "Return non-nil if SYMBOL is a fringe bitmap."
88 `(get ,symbol 'fringe)) 88 `(get ,symbol 'fringe))
89 89
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index a2a122cf5d8..e23fd0b0ca5 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -412,25 +412,25 @@ size, and full-buffer size."
412 (cdr (assq 'color shr-stylesheet)) 412 (cdr (assq 'color shr-stylesheet))
413 (cdr (assq 'background-color shr-stylesheet)))))))) 413 (cdr (assq 'background-color shr-stylesheet))))))))
414 414
415(defmacro shr-char-breakable-p (char) 415(define-inline shr-char-breakable-p (char)
416 "Return non-nil if a line can be broken before and after CHAR." 416 "Return non-nil if a line can be broken before and after CHAR."
417 `(aref fill-find-break-point-function-table ,char)) 417 (inline-quote (aref fill-find-break-point-function-table ,char)))
418(defmacro shr-char-nospace-p (char) 418(define-inline shr-char-nospace-p (char)
419 "Return non-nil if no space is required before and after CHAR." 419 "Return non-nil if no space is required before and after CHAR."
420 `(aref fill-nospace-between-words-table ,char)) 420 (inline-quote (aref fill-nospace-between-words-table ,char)))
421 421
422;; KINSOKU is a Japanese word meaning a rule that should not be violated. 422;; KINSOKU is a Japanese word meaning a rule that should not be violated.
423;; In Emacs, it is a term used for characters, e.g. punctuation marks, 423;; In Emacs, it is a term used for characters, e.g. punctuation marks,
424;; parentheses, and so on, that should not be placed in the beginning 424;; parentheses, and so on, that should not be placed in the beginning
425;; of a line or the end of a line. 425;; of a line or the end of a line.
426(defmacro shr-char-kinsoku-bol-p (char) 426(define-inline shr-char-kinsoku-bol-p (char)
427 "Return non-nil if a line ought not to begin with CHAR." 427 "Return non-nil if a line ought not to begin with CHAR."
428 `(let ((char ,char)) 428 (inline-letevals (char)
429 (and (not (eq char ?')) 429 (inline-quote (and (not (eq ,char ?'))
430 (aref (char-category-set char) ?>)))) 430 (aref (char-category-set ,char) ?>)))))
431(defmacro shr-char-kinsoku-eol-p (char) 431(define-inline shr-char-kinsoku-eol-p (char)
432 "Return non-nil if a line ought not to end with CHAR." 432 "Return non-nil if a line ought not to end with CHAR."
433 `(aref (char-category-set ,char) ?<)) 433 (inline-quote (aref (char-category-set ,char) ?<)))
434(unless (shr-char-kinsoku-bol-p (make-char 'japanese-jisx0208 33 35)) 434(unless (shr-char-kinsoku-bol-p (make-char 'japanese-jisx0208 33 35))
435 (load "kinsoku" nil t)) 435 (load "kinsoku" nil t))
436 436
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 26cce418e45..973e74bef3a 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -284,10 +284,6 @@ is based on the current syntax table."
284 (when (> (point) start) 284 (when (> (point) start)
285 (buffer-substring start (point))))))) 285 (buffer-substring start (point)))))))
286 286
287(defmacro tooltip-region-active-p ()
288 "Value is non-nil if the region should override command actions."
289 `(use-region-p))
290
291(defun tooltip-expr-to-print (event) 287(defun tooltip-expr-to-print (event)
292 "Return an expression that should be printed for EVENT. 288 "Return an expression that should be printed for EVENT.
293If a region is active and the mouse is inside the region, print 289If 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
295where the mouse is." 291where the mouse is."
296 (with-current-buffer (tooltip-event-buffer event) 292 (with-current-buffer (tooltip-event-buffer event)
297 (let ((point (posn-point (event-end event)))) 293 (let ((point (posn-point (event-end event))))
298 (if (tooltip-region-active-p) 294 (if (use-region-p)
299 (when (and (<= (region-beginning) point) (<= point (region-end))) 295 (when (and (<= (region-beginning) point) (<= point (region-end)))
300 (buffer-substring (region-beginning) (region-end))) 296 (buffer-substring (region-beginning) (region-end)))
301 (tooltip-identifier-from-point point))))) 297 (tooltip-identifier-from-point point)))))
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 7ba9de0f761..18fc2a1b8c0 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,9 @@
12014-12-05 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * url-future.el (url-future-done-p, url-future-completed-p)
4 (url-future-errored-p, url-future-cancelled-p):
5 * url-dav.el (url-dav-http-success-p): Use define-inline.
6
12014-11-23 Lars Magne Ingebrigtsen <larsi@gnus.org> 72014-11-23 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 8
3 * url-http.el (url-http): Respect `url-request-noninteractive'. 9 * url-http.el (url-http): Respect `url-request-noninteractive'.
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el
index 6adb2d978af..24b20ab81fc 100644
--- a/lisp/url/url-dav.el
+++ b/lisp/url/url-dav.el
@@ -479,9 +479,9 @@ names (ie: DAV:resourcetype)."
479 " <DAV:allprop/>") 479 " <DAV:allprop/>")
480 depth nil namespaces)) 480 depth nil namespaces))
481 481
482(defmacro url-dav-http-success-p (status) 482(define-inline url-dav-http-success-p (status)
483 "Return whether STATUS was the result of a successful DAV request." 483 "Return whether STATUS was the result of a successful DAV request."
484 `(= (/ (or ,status 500) 100) 2)) 484 (inline-quote (= (/ (or ,status 500) 100) 2)))
485 485
486 486
487;;; Locking support 487;;; Locking support
diff --git a/lisp/url/url-future.el b/lisp/url/url-future.el
index 0505218326b..490e6f74c68 100644
--- a/lisp/url/url-future.el
+++ b/lisp/url/url-future.el
@@ -44,17 +44,17 @@
44 44
45(cl-defstruct url-future callback errorback status value) 45(cl-defstruct url-future callback errorback status value)
46 46
47(defmacro url-future-done-p (url-future) 47(define-inline url-future-done-p (url-future)
48 `(url-future-status ,url-future)) 48 (inline-quote (url-future-status ,url-future)))
49 49
50(defmacro url-future-completed-p (url-future) 50(define-inline url-future-completed-p (url-future)
51 `(eq (url-future-status ,url-future) t)) 51 (inline-quote (eq (url-future-status ,url-future) t)))
52 52
53(defmacro url-future-errored-p (url-future) 53(define-inline url-future-errored-p (url-future)
54 `(eq (url-future-status ,url-future) 'error)) 54 (inline-quote (eq (url-future-status ,url-future) 'error)))
55 55
56(defmacro url-future-cancelled-p (url-future) 56(define-inline url-future-cancelled-p (url-future)
57 `(eq (url-future-status ,url-future) 'cancel)) 57 (inline-quote (eq (url-future-status ,url-future) 'cancel)))
58 58
59(defun url-future-finish (url-future &optional status) 59(defun url-future-finish (url-future &optional status)
60 (if (url-future-done-p url-future) 60 (if (url-future-done-p url-future)
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index 589ea454965..9669e2c2313 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -24,6 +24,8 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(require 'cl-lib)
28
27;; Start compiler pacifier 29;; Start compiler pacifier
28(defvar ediff-metajob-name) 30(defvar ediff-metajob-name)
29(defvar ediff-meta-buffer) 31(defvar ediff-meta-buffer)
@@ -118,11 +120,8 @@ It needs to be killed when we quit the session.")
118 (?C . ediff-buffer-C))) 120 (?C . ediff-buffer-C)))
119 121
120;;; Macros 122;;; Macros
121(defmacro ediff-odd-p (arg) 123(defsubst ediff-buffer-live-p (buf)
122 `(eq (logand ,arg 1) 1)) 124 (and buf (get-buffer buf) (buffer-name (get-buffer buf))))
123
124(defmacro ediff-buffer-live-p (buf)
125 `(and ,buf (get-buffer ,buf) (buffer-name (get-buffer ,buf))))
126 125
127(defmacro ediff-get-buffer (arg) 126(defmacro ediff-get-buffer (arg)
128 `(cond ((eq ,arg 'A) ediff-buffer-A) 127 `(cond ((eq ,arg 'A) ediff-buffer-A)
@@ -1456,7 +1455,7 @@ This default should work without changes."
1456 ;; The value of dif-num is always 1- the one that user sees. 1455 ;; The value of dif-num is always 1- the one that user sees.
1457 ;; This is why even face is used when dif-num is odd. 1456 ;; This is why even face is used when dif-num is odd.
1458 (ediff-get-symbol-from-alist 1457 (ediff-get-symbol-from-alist
1459 buf-type (if (ediff-odd-p dif-num) 1458 buf-type (if (cl-oddp dif-num)
1460 ediff-even-diff-face-alist 1459 ediff-even-diff-face-alist
1461 ediff-odd-diff-face-alist) 1460 ediff-odd-diff-face-alist)
1462 )) 1461 ))