diff options
| author | Joakim Verona | 2010-08-20 22:00:00 +0200 |
|---|---|---|
| committer | Joakim Verona | 2010-08-20 22:00:00 +0200 |
| commit | 38f9163d622c5024a75775ce1a2fc9e99e4bd9cb (patch) | |
| tree | d7ae74d47cd743840f6e6c79b850bc6c1a4b1081 /lisp | |
| parent | ccd806186417c006a97ac89162d2af3acb3d3047 (diff) | |
| parent | ff2de6d2bb239c5fdcfaba2c8efd5c62610e3b7d (diff) | |
| download | emacs-38f9163d622c5024a75775ce1a2fc9e99e4bd9cb.tar.gz emacs-38f9163d622c5024a75775ce1a2fc9e99e4bd9cb.zip | |
merge from upstream
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/facemenu.el | 105 | ||||
| -rw-r--r-- | lisp/files.el | 45 | ||||
| -rw-r--r-- | lisp/simple.el | 4 |
4 files changed, 110 insertions, 56 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 333764d846c..4902da03f4d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2010-08-19 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * files.el (locate-file-completion-table): Only list the .el and .elc | ||
| 4 | extensions if there's no other choice (bug#5955). | ||
| 5 | |||
| 6 | * facemenu.el (facemenu-self-insert-data): New var. | ||
| 7 | (facemenu-post-self-insert-function, facemenu-set-self-insert-face): | ||
| 8 | New functions. | ||
| 9 | (facemenu-add-face): Use them. | ||
| 10 | |||
| 11 | * simple.el (blink-matching-open): Obey forward-sexp-function. | ||
| 12 | |||
| 1 | 2010-08-18 Stefan Monnier <monnier@iro.umontreal.ca> | 13 | 2010-08-18 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 14 | ||
| 3 | * simple.el (prog-mode-map): New var. | 15 | * simple.el (prog-mode-map): New var. |
diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 20b86676ea9..992c6418d45 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el | |||
| @@ -699,6 +699,22 @@ determine the correct answer." | |||
| 699 | (cond ((equal a b) t) | 699 | (cond ((equal a b) t) |
| 700 | ((equal (color-values a) (color-values b))))) | 700 | ((equal (color-values a) (color-values b))))) |
| 701 | 701 | ||
| 702 | |||
| 703 | (defvar facemenu-self-insert-data nil) | ||
| 704 | |||
| 705 | (defun facemenu-post-self-insert-function () | ||
| 706 | (when (and (car facemenu-self-insert-data) | ||
| 707 | (eq last-command (cdr facemenu-self-insert-data))) | ||
| 708 | (put-text-property (1- (point)) (point) | ||
| 709 | 'face (car facemenu-self-insert-data)) | ||
| 710 | (setq facemenu-self-insert-data nil)) | ||
| 711 | (remove-hook 'post-self-insert-hook 'facemenu-post-self-insert-function)) | ||
| 712 | |||
| 713 | (defun facemenu-set-self-insert-face (face) | ||
| 714 | "Arrange for the next self-inserted char to have face `face'." | ||
| 715 | (setq facemenu-self-insert-data (cons face this-command)) | ||
| 716 | (add-hook 'post-self-insert-hook 'facemenu-post-self-insert-function)) | ||
| 717 | |||
| 702 | (defun facemenu-add-face (face &optional start end) | 718 | (defun facemenu-add-face (face &optional start end) |
| 703 | "Add FACE to text between START and END. | 719 | "Add FACE to text between START and END. |
| 704 | If START is nil or START to END is empty, add FACE to next typed character | 720 | If START is nil or START to END is empty, add FACE to next typed character |
| @@ -712,51 +728,52 @@ As a special case, if FACE is `default', then the region is left with NO face | |||
| 712 | text property. Otherwise, selecting the default face would not have any | 728 | text property. Otherwise, selecting the default face would not have any |
| 713 | effect. See `facemenu-remove-face-function'." | 729 | effect. See `facemenu-remove-face-function'." |
| 714 | (interactive "*xFace: \nr") | 730 | (interactive "*xFace: \nr") |
| 715 | (if (and (eq face 'default) | 731 | (cond |
| 716 | (not (eq facemenu-remove-face-function t))) | 732 | ((and (eq face 'default) |
| 717 | (if facemenu-remove-face-function | 733 | (not (eq facemenu-remove-face-function t))) |
| 718 | (funcall facemenu-remove-face-function start end) | 734 | (if facemenu-remove-face-function |
| 719 | (if (and start (< start end)) | 735 | (funcall facemenu-remove-face-function start end) |
| 720 | (remove-text-properties start end '(face default)) | ||
| 721 | (setq self-insert-face 'default | ||
| 722 | self-insert-face-command this-command))) | ||
| 723 | (if facemenu-add-face-function | ||
| 724 | (save-excursion | ||
| 725 | (if end (goto-char end)) | ||
| 726 | (save-excursion | ||
| 727 | (if start (goto-char start)) | ||
| 728 | (insert-before-markers | ||
| 729 | (funcall facemenu-add-face-function face end))) | ||
| 730 | (if facemenu-end-add-face | ||
| 731 | (insert (if (stringp facemenu-end-add-face) | ||
| 732 | facemenu-end-add-face | ||
| 733 | (funcall facemenu-end-add-face face))))) | ||
| 734 | (if (and start (< start end)) | 736 | (if (and start (< start end)) |
| 735 | (let ((part-start start) part-end) | 737 | (remove-text-properties start end '(face default)) |
| 736 | (while (not (= part-start end)) | 738 | (facemenu-set-self-insert-face 'default)))) |
| 737 | (setq part-end (next-single-property-change part-start 'face | 739 | (facemenu-add-face-function |
| 738 | nil end)) | 740 | (save-excursion |
| 739 | (let ((prev (get-text-property part-start 'face))) | 741 | (if end (goto-char end)) |
| 740 | (put-text-property part-start part-end 'face | 742 | (save-excursion |
| 741 | (if (null prev) | 743 | (if start (goto-char start)) |
| 742 | face | 744 | (insert-before-markers |
| 743 | (facemenu-active-faces | 745 | (funcall facemenu-add-face-function face end))) |
| 744 | (cons face | 746 | (if facemenu-end-add-face |
| 745 | (if (listp prev) | 747 | (insert (if (stringp facemenu-end-add-face) |
| 746 | prev | 748 | facemenu-end-add-face |
| 747 | (list prev))) | 749 | (funcall facemenu-end-add-face face)))))) |
| 748 | ;; Specify the selected frame | 750 | ((and start (< start end)) |
| 749 | ;; because nil would mean to use | 751 | (let ((part-start start) part-end) |
| 750 | ;; the new-frame default settings, | 752 | (while (not (= part-start end)) |
| 751 | ;; and those are usually nil. | 753 | (setq part-end (next-single-property-change part-start 'face |
| 752 | (selected-frame))))) | 754 | nil end)) |
| 753 | (setq part-start part-end))) | 755 | (let ((prev (get-text-property part-start 'face))) |
| 754 | (setq self-insert-face (if (eq last-command self-insert-face-command) | 756 | (put-text-property part-start part-end 'face |
| 755 | (cons face (if (listp self-insert-face) | 757 | (if (null prev) |
| 756 | self-insert-face | 758 | face |
| 757 | (list self-insert-face))) | 759 | (facemenu-active-faces |
| 758 | face) | 760 | (cons face |
| 759 | self-insert-face-command this-command)))) | 761 | (if (listp prev) |
| 762 | prev | ||
| 763 | (list prev))) | ||
| 764 | ;; Specify the selected frame | ||
| 765 | ;; because nil would mean to use | ||
| 766 | ;; the new-frame default settings, | ||
| 767 | ;; and those are usually nil. | ||
| 768 | (selected-frame))))) | ||
| 769 | (setq part-start part-end)))) | ||
| 770 | (t | ||
| 771 | (facemenu-set-self-insert-face | ||
| 772 | (if (eq last-command (cdr facemenu-self-insert-data)) | ||
| 773 | (cons face (if (listp (car facemenu-self-insert-data)) | ||
| 774 | (car facemenu-self-insert-data) | ||
| 775 | (list (car facemenu-self-insert-data)))) | ||
| 776 | face)))) | ||
| 760 | (unless (facemenu-enable-faces-p) | 777 | (unless (facemenu-enable-faces-p) |
| 761 | (message "Font-lock mode will override any faces you set in this buffer"))) | 778 | (message "Font-lock mode will override any faces you set in this buffer"))) |
| 762 | 779 | ||
diff --git a/lisp/files.el b/lisp/files.el index 8b131e04ebc..9a07509ed8b 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -757,21 +757,44 @@ one or more of those symbols." | |||
| 757 | (let ((x (file-name-directory suffix))) | 757 | (let ((x (file-name-directory suffix))) |
| 758 | (if x (1- (length x)) (length suffix)))))) | 758 | (if x (1- (length x)) (length suffix)))))) |
| 759 | (t | 759 | (t |
| 760 | (let ((names nil) | 760 | (let ((names '()) |
| 761 | ;; If we have files like "foo.el" and "foo.elc", we could load one of | ||
| 762 | ;; them with "foo.el", "foo.elc", or "foo", where just "foo" is the | ||
| 763 | ;; preferred way. So if we list all 3, that gives a lot of redundant | ||
| 764 | ;; entries for the poor soul looking just for "foo". OTOH, sometimes | ||
| 765 | ;; the user does want to pay attention to the extension. We try to | ||
| 766 | ;; diffuse this tension by stripping the suffix, except when the | ||
| 767 | ;; result is a single element (i.e. usually we only list "foo" unless | ||
| 768 | ;; it's the only remaining element in the list, in which case we do | ||
| 769 | ;; list "foo", "foo.elc" and "foo.el"). | ||
| 770 | (fullnames '()) | ||
| 761 | (suffix (concat (regexp-opt suffixes t) "\\'")) | 771 | (suffix (concat (regexp-opt suffixes t) "\\'")) |
| 762 | (string-dir (file-name-directory string)) | 772 | (string-dir (file-name-directory string)) |
| 763 | (string-file (file-name-nondirectory string))) | 773 | (string-file (file-name-nondirectory string))) |
| 764 | (dolist (dir dirs) | 774 | (dolist (dir dirs) |
| 765 | (unless dir | 775 | (unless dir |
| 766 | (setq dir default-directory)) | 776 | (setq dir default-directory)) |
| 767 | (if string-dir (setq dir (expand-file-name string-dir dir))) | 777 | (if string-dir (setq dir (expand-file-name string-dir dir))) |
| 768 | (when (file-directory-p dir) | 778 | (when (file-directory-p dir) |
| 769 | (dolist (file (file-name-all-completions | 779 | (dolist (file (file-name-all-completions |
| 770 | string-file dir)) | 780 | string-file dir)) |
| 771 | (push file names) | 781 | (if (not (string-match suffix file)) |
| 772 | (when (string-match suffix file) | 782 | (push file names) |
| 773 | (setq file (substring file 0 (match-beginning 0))) | 783 | (push file fullnames) |
| 774 | (push file names))))) | 784 | (push (substring file 0 (match-beginning 0)) names))))) |
| 785 | ;; Switching from names to names+fullnames creates a non-monotonicity | ||
| 786 | ;; which can cause problems with things like partial-completion. | ||
| 787 | ;; To minimize the problem, filter out completion-regexp-list, so that | ||
| 788 | ;; M-x load-library RET t/x.e TAB finds some files. | ||
| 789 | (if completion-regexp-list | ||
| 790 | (setq names (all-completions "" names))) | ||
| 791 | ;; Remove duplicates of the first element, so that we can easily check | ||
| 792 | ;; if `names' really only contains a single element. | ||
| 793 | (when (cdr names) (setcdr names (delete (car names) (cdr names)))) | ||
| 794 | (unless (cdr names) | ||
| 795 | ;; There's no more than one matching non-suffixed element, so expand | ||
| 796 | ;; the list by adding the suffixed elements as well. | ||
| 797 | (setq names (nconc names fullnames))) | ||
| 775 | (completion-table-with-context | 798 | (completion-table-with-context |
| 776 | string-dir names string-file pred action))))) | 799 | string-dir names string-file pred action))))) |
| 777 | 800 | ||
diff --git a/lisp/simple.el b/lisp/simple.el index 7c941fd63b9..b998eef88a0 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -5495,7 +5495,9 @@ it skips the contents of comments that end before point." | |||
| 5495 | (and parse-sexp-ignore-comments | 5495 | (and parse-sexp-ignore-comments |
| 5496 | (not blink-matching-paren-dont-ignore-comments)))) | 5496 | (not blink-matching-paren-dont-ignore-comments)))) |
| 5497 | (condition-case () | 5497 | (condition-case () |
| 5498 | (scan-sexps oldpos -1) | 5498 | (progn |
| 5499 | (forward-sexp -1) | ||
| 5500 | (point)) | ||
| 5499 | (error nil)))))) | 5501 | (error nil)))))) |
| 5500 | (matching-paren | 5502 | (matching-paren |
| 5501 | (and blinkpos | 5503 | (and blinkpos |