aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2012-09-28 08:18:38 -0400
committerStefan Monnier2012-09-28 08:18:38 -0400
commit7f457c067de84a0973883ef7889e648fbb17b055 (patch)
tree383fbed3db4f76978b857b8dceaa2978fc9bd10a
parentc00ebc9835590d94d2b2f241ffcad872a2f2ffd3 (diff)
downloademacs-7f457c067de84a0973883ef7889e648fbb17b055.tar.gz
emacs-7f457c067de84a0973883ef7889e648fbb17b055.zip
* lisp/emacs-lisp/pcase.el (pcase--mark-used): New.
(pcase--u1): Use it. * lisp/custom.el (load-theme): Set buffer-file-name so the load is recorded in load-history with the right file name. Fixes: debbugs:12512
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/custom.el3
-rw-r--r--lisp/emacs-lisp/pcase.el14
3 files changed, 19 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cc884e9b1b5..21a412f7424 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12012-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/pcase.el (pcase--mark-used): New.
4 (pcase--u1): Use it (bug#12512).
5
6 * custom.el (load-theme): Set buffer-file-name so the load is recorded
7 in load-history with the right file name.
8
12012-09-28 Tassilo Horn <tsdh@gnu.org> 92012-09-28 Tassilo Horn <tsdh@gnu.org>
2 10
3 * doc-view.el (doc-view-current-cache-doc-pdf): New function. 11 * doc-view.el (doc-view-current-cache-doc-pdf): New function.
diff --git a/lisp/custom.el b/lisp/custom.el
index dfc8e631152..dc810e3c97d 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1193,7 +1193,8 @@ Return t if THEME was successfully loaded, nil otherwise."
1193 (expand-file-name "themes/" data-directory))) 1193 (expand-file-name "themes/" data-directory)))
1194 (member hash custom-safe-themes) 1194 (member hash custom-safe-themes)
1195 (custom-theme-load-confirm hash)) 1195 (custom-theme-load-confirm hash))
1196 (let ((custom--inhibit-theme-enable t)) 1196 (let ((custom--inhibit-theme-enable t)
1197 (buffer-file-name fn)) ;For load-history.
1197 (eval-buffer)) 1198 (eval-buffer))
1198 ;; Optimization: if the theme changes the `default' face, put that 1199 ;; Optimization: if the theme changes the `default' face, put that
1199 ;; entry first. This avoids some `frame-set-background-mode' rigmarole 1200 ;; entry first. This avoids some `frame-set-background-mode' rigmarole
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 09e47b69b91..1312fc3731d 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -517,6 +517,10 @@ MATCH is the pattern that needs to be matched, of the form:
517(defun pcase--self-quoting-p (upat) 517(defun pcase--self-quoting-p (upat)
518 (or (keywordp upat) (numberp upat) (stringp upat))) 518 (or (keywordp upat) (numberp upat) (stringp upat)))
519 519
520(defsubst pcase--mark-used (sym)
521 ;; Exceptionally, `sym' may be a constant expression rather than a symbol.
522 (if (symbolp sym) (put sym 'pcase-used t)))
523
520;; It's very tempting to use `pcase' below, tho obviously, it'd create 524;; It's very tempting to use `pcase' below, tho obviously, it'd create
521;; bootstrapping problems. 525;; bootstrapping problems.
522(defun pcase--u1 (matches code vars rest) 526(defun pcase--u1 (matches code vars rest)
@@ -581,7 +585,7 @@ Otherwise, it defers to REST which is a list of branches of the form
581 ((memq upat '(t _)) (pcase--u1 matches code vars rest)) 585 ((memq upat '(t _)) (pcase--u1 matches code vars rest))
582 ((eq upat 'pcase--dontcare) :pcase--dontcare) 586 ((eq upat 'pcase--dontcare) :pcase--dontcare)
583 ((memq (car-safe upat) '(guard pred)) 587 ((memq (car-safe upat) '(guard pred))
584 (if (eq (car upat) 'pred) (put sym 'pcase-used t)) 588 (if (eq (car upat) 'pred) (pcase--mark-used sym))
585 (let* ((splitrest 589 (let* ((splitrest
586 (pcase--split-rest 590 (pcase--split-rest
587 sym (lambda (pat) (pcase--split-pred upat pat)) rest)) 591 sym (lambda (pat) (pcase--split-pred upat pat)) rest))
@@ -614,10 +618,10 @@ Otherwise, it defers to REST which is a list of branches of the form
614 (pcase--u1 matches code vars then-rest) 618 (pcase--u1 matches code vars then-rest)
615 (pcase--u else-rest)))) 619 (pcase--u else-rest))))
616 ((pcase--self-quoting-p upat) 620 ((pcase--self-quoting-p upat)
617 (put sym 'pcase-used t) 621 (pcase--mark-used sym)
618 (pcase--q1 sym upat matches code vars rest)) 622 (pcase--q1 sym upat matches code vars rest))
619 ((symbolp upat) 623 ((symbolp upat)
620 (put sym 'pcase-used t) 624 (pcase--mark-used sym)
621 (if (not (assq upat vars)) 625 (if (not (assq upat vars))
622 (pcase--u1 matches code (cons (cons upat sym) vars) rest) 626 (pcase--u1 matches code (cons (cons upat sym) vars) rest)
623 ;; Non-linear pattern. Turn it into an `eq' test. 627 ;; Non-linear pattern. Turn it into an `eq' test.
@@ -640,7 +644,7 @@ Otherwise, it defers to REST which is a list of branches of the form
640 (pcase--u1 (cons `(match ,sym . ,(nth 1 upat)) matches) 644 (pcase--u1 (cons `(match ,sym . ,(nth 1 upat)) matches)
641 code vars rest))) 645 code vars rest)))
642 ((eq (car-safe upat) '\`) 646 ((eq (car-safe upat) '\`)
643 (put sym 'pcase-used t) 647 (pcase--mark-used sym)
644 (pcase--q1 sym (cadr upat) matches code vars rest)) 648 (pcase--q1 sym (cadr upat) matches code vars rest))
645 ((eq (car-safe upat) 'or) 649 ((eq (car-safe upat) 'or)
646 (let ((all (> (length (cdr upat)) 1)) 650 (let ((all (> (length (cdr upat)) 1))
@@ -662,7 +666,7 @@ Otherwise, it defers to REST which is a list of branches of the form
662 sym (lambda (pat) (pcase--split-member elems pat)) rest)) 666 sym (lambda (pat) (pcase--split-member elems pat)) rest))
663 (then-rest (car splitrest)) 667 (then-rest (car splitrest))
664 (else-rest (cdr splitrest))) 668 (else-rest (cdr splitrest)))
665 (put sym 'pcase-used t) 669 (pcase--mark-used sym)
666 (pcase--if `(,(if memq-fine #'memq #'member) ,sym ',elems) 670 (pcase--if `(,(if memq-fine #'memq #'member) ,sym ',elems)
667 (pcase--u1 matches code vars then-rest) 671 (pcase--u1 matches code vars then-rest)
668 (pcase--u else-rest))) 672 (pcase--u else-rest)))