diff options
| author | Chong Yidong | 2010-08-30 21:53:46 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-08-30 21:53:46 -0400 |
| commit | 187d3296ae0549b978420786e7079ff426a13574 (patch) | |
| tree | 3b70f67dbf3c414ac464f4e5110200270e2c9343 | |
| parent | 14721afcd6ed26ccd35264b0e99b3e8da7837f2e (diff) | |
| download | emacs-187d3296ae0549b978420786e7079ff426a13574.tar.gz emacs-187d3296ae0549b978420786e7079ff426a13574.zip | |
Fix several Package Menu and Finder bugs.
* finder.el: Load finder-inf using `require'.
(finder-list-matches): Sorting by status is now the default.
(finder-compile-keywords): Simpify printing.
* emacs-lisp/package.el (package--read-archive-file): Just use
`read', to avoid copying an additional string.
(package-menu-mode): Set header-line-format here.
(package-menu-refresh, package-menu-revert): Signal an error if
not in the Package Menu.
(package-menu-package-list): New var.
(package--generate-package-list): Operate on the current buffer;
don't assume that it is *Packages*, since the user may rename it.
Allow persistent package listings and sort keys using
package-menu-package-list and package-menu-package-sort-key.
(package-menu--version-predicate): Fix version calculation.
(package-menu-sort-by-column): Don't select the window.
(package--list-packages): Create the *Packages* buffer. Set
package-menu-package-list-key.
(list-packages): Sorting by status is now the default.
(package-buffer-info): Use match-string-no-properties.
(define-package): Add a &rest argument for future proofing, but
don't use it yet.
(package-install-from-buffer, package-install-buffer-internal):
Merged into a single function, package-install-from-buffer.
(package-install-file): Caller changed.
Also, fix headers for hfy-cmap.el and ps-print.el.
| -rw-r--r-- | lisp/ChangeLog | 28 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-loaddefs.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 462 | ||||
| -rw-r--r-- | lisp/finder.el | 22 | ||||
| -rw-r--r-- | lisp/hfy-cmap.el | 1 | ||||
| -rw-r--r-- | lisp/ps-print.el | 1 |
6 files changed, 267 insertions, 249 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8e9c9a7b251..858388595c5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,31 @@ | |||
| 1 | 2010-08-31 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * emacs-lisp/package.el (package--read-archive-file): Just use | ||
| 4 | `read', to avoid copying an additional string. | ||
| 5 | (package-menu-mode): Set header-line-format here. | ||
| 6 | (package-menu-refresh, package-menu-revert): Signal an error if | ||
| 7 | not in the Package Menu. | ||
| 8 | (package-menu-package-list): New var. | ||
| 9 | (package--generate-package-list): Operate on the current buffer; | ||
| 10 | don't assume that it is *Packages*, since the user may rename it. | ||
| 11 | Allow persistent package listings and sort keys using | ||
| 12 | package-menu-package-list and package-menu-package-sort-key. | ||
| 13 | (package-menu--version-predicate): Fix version calculation. | ||
| 14 | (package-menu-sort-by-column): Don't select the window. | ||
| 15 | (package--list-packages): Create the *Packages* buffer. Set | ||
| 16 | package-menu-package-list-key. | ||
| 17 | (list-packages): Sorting by status is now the default. | ||
| 18 | (package-buffer-info): Use match-string-no-properties. | ||
| 19 | (define-package): Add a &rest argument for future proofing, but | ||
| 20 | don't use it yet. | ||
| 21 | (package-install-from-buffer, package-install-buffer-internal): | ||
| 22 | Merged into a single function, package-install-from-buffer. | ||
| 23 | (package-install-file): Caller changed. | ||
| 24 | |||
| 25 | * finder.el: Load finder-inf using `require'. | ||
| 26 | (finder-list-matches): Sorting by status is now the default. | ||
| 27 | (finder-compile-keywords): Simpify printing. | ||
| 28 | |||
| 1 | 2010-08-30 Stefan Monnier <monnier@iro.umontreal.ca> | 29 | 2010-08-30 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 30 | ||
| 3 | * progmodes/octave-mod.el (octave-font-lock-keywords): Use regexp-opt. | 31 | * progmodes/octave-mod.el (octave-font-lock-keywords): Use regexp-opt. |
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index 98b3c8e52e0..1efeae382f9 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el | |||
| @@ -754,7 +754,7 @@ surrounded by (block NAME ...). | |||
| 754 | ;;;;;; find nsubstitute-if-not nsubstitute-if nsubstitute substitute-if-not | 754 | ;;;;;; find nsubstitute-if-not nsubstitute-if nsubstitute substitute-if-not |
| 755 | ;;;;;; substitute-if substitute delete-duplicates remove-duplicates | 755 | ;;;;;; substitute-if substitute delete-duplicates remove-duplicates |
| 756 | ;;;;;; delete-if-not delete-if delete* remove-if-not remove-if remove* | 756 | ;;;;;; delete-if-not delete-if delete* remove-if-not remove-if remove* |
| 757 | ;;;;;; replace fill reduce) "cl-seq" "cl-seq.el" "8f4ba525c894365101b9a53905db94ba") | 757 | ;;;;;; replace fill reduce) "cl-seq" "cl-seq.el" "7b7531276ddf8457abecdd487d3cf0b7") |
| 758 | ;;; Generated autoloads from cl-seq.el | 758 | ;;; Generated autoloads from cl-seq.el |
| 759 | 759 | ||
| 760 | (autoload 'reduce "cl-seq" "\ | 760 | (autoload 'reduce "cl-seq" "\ |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 214830b8b54..78e528285d4 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -471,17 +471,18 @@ Return nil if the package could not be activated." | |||
| 471 | pkg-vec))) | 471 | pkg-vec))) |
| 472 | package-obsolete-alist))))) | 472 | package-obsolete-alist))))) |
| 473 | 473 | ||
| 474 | ;; (define-package "emacs" "21.4.1" "GNU Emacs core package.") | ||
| 475 | ;; (define-package "erc" "5.1" "ERC - irc client" '((emacs "21.0"))) | ||
| 476 | (defun define-package (name-str version-string | 474 | (defun define-package (name-str version-string |
| 477 | &optional docstring requirements) | 475 | &optional docstring requirements |
| 476 | &rest extra-properties) | ||
| 478 | "Define a new package. | 477 | "Define a new package. |
| 479 | NAME is the name of the package, a string. | 478 | NAME is the name of the package, a string. |
| 480 | VERSION-STRING is the version of the package, a dotted sequence | 479 | VERSION-STRING is the version of the package, a dotted sequence |
| 481 | of integers. | 480 | of integers. |
| 482 | DOCSTRING is the optional description. | 481 | DOCSTRING is the optional description. |
| 483 | REQUIREMENTS is a list of requirements on other packages. | 482 | REQUIREMENTS is a list of requirements on other packages. |
| 484 | Each requirement is of the form (OTHER-PACKAGE \"VERSION\")." | 483 | Each requirement is of the form (OTHER-PACKAGE \"VERSION\"). |
| 484 | |||
| 485 | EXTRA-PROPERTIES is currently unused." | ||
| 485 | (let* ((name (intern name-str)) | 486 | (let* ((name (intern name-str)) |
| 486 | (pkg-desc (assq name package-alist)) | 487 | (pkg-desc (assq name package-alist)) |
| 487 | (new-version (version-to-list version-string)) | 488 | (new-version (version-to-list version-string)) |
| @@ -717,13 +718,13 @@ but version %s required" | |||
| 717 | "Read a Lisp expression from STR. | 718 | "Read a Lisp expression from STR. |
| 718 | Signal an error if the entire string was not used." | 719 | Signal an error if the entire string was not used." |
| 719 | (let* ((read-data (read-from-string str)) | 720 | (let* ((read-data (read-from-string str)) |
| 720 | (more-left | 721 | (more-left |
| 721 | (condition-case nil | 722 | (condition-case nil |
| 722 | ;; The call to `ignore' suppresses a compiler warning. | 723 | ;; The call to `ignore' suppresses a compiler warning. |
| 723 | (progn (ignore (read-from-string | 724 | (progn (ignore (read-from-string |
| 724 | (substring str (cdr read-data)))) | 725 | (substring str (cdr read-data)))) |
| 725 | t) | 726 | t) |
| 726 | (end-of-file nil)))) | 727 | (end-of-file nil)))) |
| 727 | (if more-left | 728 | (if more-left |
| 728 | (error "Can't read whole string") | 729 | (error "Can't read whole string") |
| 729 | (car read-data)))) | 730 | (car read-data)))) |
| @@ -733,16 +734,14 @@ Signal an error if the entire string was not used." | |||
| 733 | Will return the data from the file, or nil if the file does not exist. | 734 | Will return the data from the file, or nil if the file does not exist. |
| 734 | Will throw an error if the archive version is too new." | 735 | Will throw an error if the archive version is too new." |
| 735 | (let ((filename (expand-file-name file package-user-dir))) | 736 | (let ((filename (expand-file-name file package-user-dir))) |
| 736 | (if (file-exists-p filename) | 737 | (when (file-exists-p filename) |
| 737 | (with-temp-buffer | 738 | (with-temp-buffer |
| 738 | (insert-file-contents-literally filename) | 739 | (insert-file-contents-literally filename) |
| 739 | (let ((contents (package-read-from-string | 740 | (let ((contents (read (current-buffer)))) |
| 740 | (buffer-substring-no-properties (point-min) | 741 | (if (> (car contents) package-archive-version) |
| 741 | (point-max))))) | 742 | (error "Package archive version %d is higher than %d" |
| 742 | (if (> (car contents) package-archive-version) | 743 | (car contents) package-archive-version)) |
| 743 | (error "Package archive version %d is greater than %d - upgrade package.el" | 744 | (cdr contents)))))) |
| 744 | (car contents) package-archive-version)) | ||
| 745 | (cdr contents)))))) | ||
| 746 | 745 | ||
| 747 | (defun package-read-all-archive-contents () | 746 | (defun package-read-all-archive-contents () |
| 748 | "Re-read `archive-contents', if it exists. | 747 | "Re-read `archive-contents', if it exists. |
| @@ -751,18 +750,17 @@ If successful, set `package-archive-contents'." | |||
| 751 | (package-read-archive-contents (car archive)))) | 750 | (package-read-archive-contents (car archive)))) |
| 752 | 751 | ||
| 753 | (defun package-read-archive-contents (archive) | 752 | (defun package-read-archive-contents (archive) |
| 754 | "Re-read `archive-contents' and `builtin-packages' for ARCHIVE. | 753 | "Re-read archive contents for ARCHIVE. |
| 755 | If successful, set `package-archive-contents' and `package--builtins'. | 754 | If successful, set the variable `package-archive-contents'. |
| 756 | If the archive version is too new, signal an error." | 755 | If the archive version is too new, signal an error." |
| 757 | (let ((archive-contents (package--read-archive-file | 756 | ;; Version 1 of 'archive-contents' is identical to our internal |
| 758 | (concat "archives/" archive | 757 | ;; representation. |
| 759 | "/archive-contents")))) | 758 | (let* ((dir (concat "archives/" archive)) |
| 760 | (if archive-contents | 759 | (contents-file (concat dir "/archive-contents")) |
| 761 | ;; Version 1 of 'archive-contents' is identical to our | 760 | contents) |
| 762 | ;; internal representation. | 761 | (when (setq contents (package--read-archive-file contents-file)) |
| 763 | ;; TODO: merge archive lists | 762 | (dolist (package contents) |
| 764 | (dolist (package archive-contents) | 763 | (package--add-to-archive-contents package archive))))) |
| 765 | (package--add-to-archive-contents package archive))))) | ||
| 766 | 764 | ||
| 767 | (defun package--add-to-archive-contents (package archive) | 765 | (defun package--add-to-archive-contents (package archive) |
| 768 | "Add the PACKAGE from the given ARCHIVE if necessary. | 766 | "Add the PACKAGE from the given ARCHIVE if necessary. |
| @@ -833,61 +831,60 @@ Otherwise return nil." | |||
| 833 | v-str)))) | 831 | v-str)))) |
| 834 | 832 | ||
| 835 | (defun package-buffer-info () | 833 | (defun package-buffer-info () |
| 836 | "Return a vector of information about the package in the current buffer. | 834 | "Return a vector describing the package in the current buffer. |
| 837 | The vector looks like [FILENAME REQUIRES DESCRIPTION VERSION COMMENTARY] | 835 | The vector has the form |
| 838 | FILENAME is the file name, a string. It does not have the \".el\" extension. | 836 | |
| 837 | [FILENAME REQUIRES DESCRIPTION VERSION COMMENTARY] | ||
| 838 | |||
| 839 | FILENAME is the file name, a string, sans the \".el\" extension. | ||
| 839 | REQUIRES is a requires list, or nil. | 840 | REQUIRES is a requires list, or nil. |
| 840 | DESCRIPTION is the package description (a string). | 841 | DESCRIPTION is the package description, a string. |
| 841 | VERSION is the version, a string. | 842 | VERSION is the version, a string. |
| 842 | COMMENTARY is the commentary section, a string, or nil if none. | 843 | COMMENTARY is the commentary section, a string, or nil if none. |
| 843 | Throws an exception if the buffer does not contain a conforming package. | 844 | |
| 844 | If there is a package, narrows the buffer to the file's boundaries. | 845 | If the buffer does not contain a conforming package, signal an |
| 845 | May narrow buffer or move point even on failure." | 846 | error. If there is a package, narrow the buffer to the file's |
| 847 | boundaries." | ||
| 846 | (goto-char (point-min)) | 848 | (goto-char (point-min)) |
| 847 | (if (re-search-forward "^;;; \\([^ ]*\\)\\.el --- \\(.*\\)$" nil t) | 849 | (unless (re-search-forward "^;;; \\([^ ]*\\)\\.el --- \\(.*\\)$" nil t) |
| 848 | (let ((file-name (match-string 1)) | 850 | (error "Packages lacks a file header")) |
| 849 | (desc (match-string 2)) | 851 | (let ((file-name (match-string-no-properties 1)) |
| 850 | (start (progn (beginning-of-line) (point)))) | 852 | (desc (match-string-no-properties 2)) |
| 851 | (if (search-forward (concat ";;; " file-name ".el ends here")) | 853 | (start (line-beginning-position))) |
| 852 | (progn | 854 | (unless (search-forward (concat ";;; " file-name ".el ends here")) |
| 853 | ;; Try to include a trailing newline. | 855 | (error "Package lacks a terminating comment")) |
| 854 | (forward-line) | 856 | ;; Try to include a trailing newline. |
| 855 | (narrow-to-region start (point)) | 857 | (forward-line) |
| 856 | (require 'lisp-mnt) | 858 | (narrow-to-region start (point)) |
| 857 | ;; Use some headers we've invented to drive the process. | 859 | (require 'lisp-mnt) |
| 858 | (let* ((requires-str (lm-header "package-requires")) | 860 | ;; Use some headers we've invented to drive the process. |
| 859 | (requires (if requires-str | 861 | (let* ((requires-str (lm-header "package-requires")) |
| 860 | (package-read-from-string requires-str))) | 862 | (requires (if requires-str |
| 861 | ;; Prefer Package-Version, because if it is | 863 | (package-read-from-string requires-str))) |
| 862 | ;; defined the package author probably wants us | 864 | ;; Prefer Package-Version; if defined, the package author |
| 863 | ;; to use it. Otherwise try Version. | 865 | ;; probably wants us to use it. Otherwise try Version. |
| 864 | (pkg-version | 866 | (pkg-version |
| 865 | (or (package-strip-rcs-id (lm-header "package-version")) | 867 | (or (package-strip-rcs-id (lm-header "package-version")) |
| 866 | (package-strip-rcs-id (lm-header "version")))) | 868 | (package-strip-rcs-id (lm-header "version")))) |
| 867 | (commentary (lm-commentary))) | 869 | (commentary (lm-commentary))) |
| 868 | (unless pkg-version | 870 | (unless pkg-version |
| 869 | (error | 871 | (error |
| 870 | "Package does not define a usable \"Version\" or \"Package-Version\" header")) | 872 | "Package lacks a \"Version\" or \"Package-Version\" header")) |
| 871 | ;; Turn string version numbers into list form. | 873 | ;; Turn string version numbers into list form. |
| 872 | (setq requires | 874 | (setq requires |
| 873 | (mapcar | 875 | (mapcar |
| 874 | (lambda (elt) | 876 | (lambda (elt) |
| 875 | (list (car elt) | 877 | (list (car elt) |
| 876 | (version-to-list (car (cdr elt))))) | 878 | (version-to-list (car (cdr elt))))) |
| 877 | requires)) | 879 | requires)) |
| 878 | (set-text-properties 0 (length file-name) nil file-name) | 880 | (vector file-name requires desc pkg-version commentary)))) |
| 879 | (set-text-properties 0 (length pkg-version) nil pkg-version) | ||
| 880 | (set-text-properties 0 (length desc) nil desc) | ||
| 881 | (vector file-name requires desc pkg-version commentary))) | ||
| 882 | (error "Package missing a terminating comment"))) | ||
| 883 | (error "No starting comment for package"))) | ||
| 884 | 881 | ||
| 885 | (defun package-tar-file-info (file) | 882 | (defun package-tar-file-info (file) |
| 886 | "Find package information for a tar file. | 883 | "Find package information for a tar file. |
| 887 | FILE is the name of the tar file to examine. | 884 | FILE is the name of the tar file to examine. |
| 888 | The return result is a vector like `package-buffer-info'." | 885 | The return result is a vector like `package-buffer-info'." |
| 889 | (unless (string-match "^\\(.+\\)-\\([0-9.]+\\)\\.tar$" file) | 886 | (unless (string-match "^\\(.+\\)-\\([0-9.]+\\)\\.tar$" file) |
| 890 | (error "`%s' doesn't have a package-ish name" file)) | 887 | (error "Invalid package name `%s'" file)) |
| 891 | (let* ((pkg-name (file-name-nondirectory (match-string-no-properties 1 file))) | 888 | (let* ((pkg-name (file-name-nondirectory (match-string-no-properties 1 file))) |
| 892 | (pkg-version (match-string-no-properties 2 file)) | 889 | (pkg-version (match-string-no-properties 2 file)) |
| 893 | ;; Extract the package descriptor. | 890 | ;; Extract the package descriptor. |
| @@ -898,20 +895,19 @@ The return result is a vector like `package-buffer-info'." | |||
| 898 | pkg-name "-pkg.el"))) | 895 | pkg-name "-pkg.el"))) |
| 899 | (pkg-def-parsed (package-read-from-string pkg-def-contents))) | 896 | (pkg-def-parsed (package-read-from-string pkg-def-contents))) |
| 900 | (unless (eq (car pkg-def-parsed) 'define-package) | 897 | (unless (eq (car pkg-def-parsed) 'define-package) |
| 901 | (error "%s-pkg.el doesn't contain `define-package' sexp" pkg-name)) | 898 | (error "No `define-package' sexp is present in `%s-pkg.el'" pkg-name)) |
| 902 | (let ((name-str (nth 1 pkg-def-parsed)) | 899 | (let ((name-str (nth 1 pkg-def-parsed)) |
| 903 | (version-string (nth 2 pkg-def-parsed)) | 900 | (version-string (nth 2 pkg-def-parsed)) |
| 904 | (docstring (nth 3 pkg-def-parsed)) | 901 | (docstring (nth 3 pkg-def-parsed)) |
| 905 | (requires (nth 4 pkg-def-parsed)) | 902 | (requires (nth 4 pkg-def-parsed)) |
| 906 | |||
| 907 | (readme (shell-command-to-string | 903 | (readme (shell-command-to-string |
| 908 | ;; Requires GNU tar. | 904 | ;; Requires GNU tar. |
| 909 | (concat "tar -xOf " file " " | 905 | (concat "tar -xOf " file " " |
| 910 | pkg-name "-" pkg-version "/README")))) | 906 | pkg-name "-" pkg-version "/README")))) |
| 911 | (unless (equal pkg-version version-string) | 907 | (unless (equal pkg-version version-string) |
| 912 | (error "Inconsistent versions!")) | 908 | (error "Package has inconsistent versions")) |
| 913 | (unless (equal pkg-name name-str) | 909 | (unless (equal pkg-name name-str) |
| 914 | (error "Inconsistent names!")) | 910 | (error "Package has inconsistent names")) |
| 915 | ;; Kind of a hack. | 911 | ;; Kind of a hack. |
| 916 | (if (string-match ": Not found in archive" readme) | 912 | (if (string-match ": Not found in archive" readme) |
| 917 | (setq readme nil)) | 913 | (setq readme nil)) |
| @@ -919,18 +915,27 @@ The return result is a vector like `package-buffer-info'." | |||
| 919 | (if (eq (car requires) 'quote) | 915 | (if (eq (car requires) 'quote) |
| 920 | (setq requires (car (cdr requires)))) | 916 | (setq requires (car (cdr requires)))) |
| 921 | (setq requires | 917 | (setq requires |
| 922 | (mapcar | 918 | (mapcar (lambda (elt) |
| 923 | (lambda (elt) | 919 | (list (car elt) |
| 924 | (list (car elt) | 920 | (version-to-list (cadr elt)))) |
| 925 | (version-to-list (car (cdr elt))))) | 921 | requires)) |
| 926 | requires)) | ||
| 927 | (vector pkg-name requires docstring version-string readme)))) | 922 | (vector pkg-name requires docstring version-string readme)))) |
| 928 | 923 | ||
| 929 | (defun package-install-buffer-internal (pkg-info type) | 924 | ;;;###autoload |
| 925 | (defun package-install-from-buffer (pkg-info type) | ||
| 926 | "Install a package from the current buffer. | ||
| 927 | When called interactively, the current buffer is assumed to be a | ||
| 928 | single .el file that follows the packaging guidelines; see info | ||
| 929 | node `(elisp)Packaging'. | ||
| 930 | |||
| 931 | When called from Lisp, PKG-INFO is a vector describing the | ||
| 932 | information, of the type returned by `package-buffer-info'; and | ||
| 933 | TYPE is the package type (either `single' or `tar')." | ||
| 934 | (interactive (list (package-buffer-info) 'single)) | ||
| 930 | (save-excursion | 935 | (save-excursion |
| 931 | (save-restriction | 936 | (save-restriction |
| 932 | (let* ((file-name (aref pkg-info 0)) | 937 | (let* ((file-name (aref pkg-info 0)) |
| 933 | (requires (aref pkg-info 1)) | 938 | (requires (aref pkg-info 1)) |
| 934 | (desc (if (string= (aref pkg-info 2) "") | 939 | (desc (if (string= (aref pkg-info 2) "") |
| 935 | "No description available." | 940 | "No description available." |
| 936 | (aref pkg-info 2))) | 941 | (aref pkg-info 2))) |
| @@ -950,15 +955,6 @@ The return result is a vector like `package-buffer-info'." | |||
| 950 | (package-initialize))))) | 955 | (package-initialize))))) |
| 951 | 956 | ||
| 952 | ;;;###autoload | 957 | ;;;###autoload |
| 953 | (defun package-install-from-buffer () | ||
| 954 | "Install a package from the current buffer. | ||
| 955 | The package is assumed to be a single .el file which | ||
| 956 | follows the elisp comment guidelines; see | ||
| 957 | info node `(elisp)Library Headers'." | ||
| 958 | (interactive) | ||
| 959 | (package-install-buffer-internal (package-buffer-info) 'single)) | ||
| 960 | |||
| 961 | ;;;###autoload | ||
| 962 | (defun package-install-file (file) | 958 | (defun package-install-file (file) |
| 963 | "Install a package from a file. | 959 | "Install a package from a file. |
| 964 | The file can either be a tar file or an Emacs Lisp file." | 960 | The file can either be a tar file or an Emacs Lisp file." |
| @@ -966,9 +962,10 @@ The file can either be a tar file or an Emacs Lisp file." | |||
| 966 | (with-temp-buffer | 962 | (with-temp-buffer |
| 967 | (insert-file-contents-literally file) | 963 | (insert-file-contents-literally file) |
| 968 | (cond | 964 | (cond |
| 969 | ((string-match "\\.el$" file) (package-install-from-buffer)) | 965 | ((string-match "\\.el$" file) |
| 966 | (package-install-from-buffer (package-buffer-info) 'single)) | ||
| 970 | ((string-match "\\.tar$" file) | 967 | ((string-match "\\.tar$" file) |
| 971 | (package-install-buffer-internal (package-tar-file-info file) 'tar)) | 968 | (package-install-from-buffer (package-tar-file-info file) 'tar)) |
| 972 | (t (error "Unrecognized extension `%s'" (file-name-extension file)))))) | 969 | (t (error "Unrecognized extension `%s'" (file-name-extension file)))))) |
| 973 | 970 | ||
| 974 | (defun package-delete (name version) | 971 | (defun package-delete (name version) |
| @@ -1012,7 +1009,7 @@ download." | |||
| 1012 | (dolist (archive package-archives) | 1009 | (dolist (archive package-archives) |
| 1013 | (condition-case nil | 1010 | (condition-case nil |
| 1014 | (package--download-one-archive archive "archive-contents") | 1011 | (package--download-one-archive archive "archive-contents") |
| 1015 | (error (message "Failed to download archive `%s'." | 1012 | (error (message "Failed to download `%s' archive." |
| 1016 | (car archive))))) | 1013 | (car archive))))) |
| 1017 | (package-read-all-archive-contents)) | 1014 | (package-read-all-archive-contents)) |
| 1018 | 1015 | ||
| @@ -1275,10 +1272,32 @@ Letters do not insert themselves; instead, they are commands. | |||
| 1275 | (setq mode-name "Package Menu") | 1272 | (setq mode-name "Package Menu") |
| 1276 | (setq truncate-lines t) | 1273 | (setq truncate-lines t) |
| 1277 | (setq buffer-read-only t) | 1274 | (setq buffer-read-only t) |
| 1278 | ;; Support Emacs 21. | 1275 | (setq header-line-format |
| 1279 | (if (fboundp 'run-mode-hooks) | 1276 | (mapconcat |
| 1280 | (run-mode-hooks 'package-menu-mode-hook) | 1277 | (lambda (pair) |
| 1281 | (run-hooks 'package-menu-mode-hook))) | 1278 | (let ((column (car pair)) |
| 1279 | (name (cdr pair))) | ||
| 1280 | (concat | ||
| 1281 | ;; Insert a space that aligns the button properly. | ||
| 1282 | (propertize " " 'display (list 'space :align-to column) | ||
| 1283 | 'face 'fixed-pitch) | ||
| 1284 | ;; Set up the column button. | ||
| 1285 | (propertize name | ||
| 1286 | 'column-name name | ||
| 1287 | 'help-echo "mouse-1: sort by column" | ||
| 1288 | 'mouse-face 'highlight | ||
| 1289 | 'keymap package-menu-sort-button-map)))) | ||
| 1290 | ;; We take a trick from buff-menu and have a dummy leading | ||
| 1291 | ;; space to align the header line with the beginning of the | ||
| 1292 | ;; text. This doesn't really work properly on Emacs 21, but | ||
| 1293 | ;; it is close enough. | ||
| 1294 | '((0 . "") | ||
| 1295 | (2 . "Package") | ||
| 1296 | (20 . "Version") | ||
| 1297 | (32 . "Status") | ||
| 1298 | (43 . "Description")) | ||
| 1299 | "")) | ||
| 1300 | (run-mode-hooks 'package-menu-mode-hook)) | ||
| 1282 | 1301 | ||
| 1283 | (defun package-menu-refresh () | 1302 | (defun package-menu-refresh () |
| 1284 | "Download the ELPA archive. | 1303 | "Download the ELPA archive. |
| @@ -1287,12 +1306,16 @@ the Emacs Lisp Package Archive, and then refreshes the | |||
| 1287 | package menu. This lets you see what new packages are | 1306 | package menu. This lets you see what new packages are |
| 1288 | available for download." | 1307 | available for download." |
| 1289 | (interactive) | 1308 | (interactive) |
| 1309 | (unless (eq major-mode 'package-menu-mode) | ||
| 1310 | (error "The current buffer is not a Package Menu")) | ||
| 1290 | (package-refresh-contents) | 1311 | (package-refresh-contents) |
| 1291 | (package--generate-package-list)) | 1312 | (package--generate-package-list)) |
| 1292 | 1313 | ||
| 1293 | (defun package-menu-revert () | 1314 | (defun package-menu-revert () |
| 1294 | "Update the list of packages." | 1315 | "Update the list of packages." |
| 1295 | (interactive) | 1316 | (interactive) |
| 1317 | (unless (eq major-mode 'package-menu-mode) | ||
| 1318 | (error "The current buffer is not a Package Menu")) | ||
| 1296 | (package--generate-package-list)) | 1319 | (package--generate-package-list)) |
| 1297 | 1320 | ||
| 1298 | (defun package-menu-describe-package () | 1321 | (defun package-menu-describe-package () |
| @@ -1438,96 +1461,99 @@ Emacs." | |||
| 1438 | result))) | 1461 | result))) |
| 1439 | result) | 1462 | result) |
| 1440 | 1463 | ||
| 1441 | ;; This decides how we should sort; nil means by package name. | 1464 | (defvar package-menu-package-list nil |
| 1442 | (defvar package-menu-sort-key nil) | 1465 | "List of packages to display in the Package Menu buffer. |
| 1466 | A value of nil means to display all packages.") | ||
| 1443 | 1467 | ||
| 1444 | (defun package--generate-package-list (&optional packages) | 1468 | (defvar package-menu-sort-key nil |
| 1445 | (package-initialize) ; FIXME: do this here? | 1469 | "Sort key for the current Package Menu buffer.") |
| 1446 | (with-current-buffer (get-buffer-create "*Packages*") | 1470 | |
| 1471 | (defun package--generate-package-list () | ||
| 1472 | "Populate the current Package Menu buffer." | ||
| 1473 | (package-initialize) | ||
| 1474 | (let ((inhibit-read-only t) | ||
| 1475 | info-list name desc hold builtin) | ||
| 1447 | (setq buffer-read-only nil) | 1476 | (setq buffer-read-only nil) |
| 1448 | (erase-buffer) | 1477 | (erase-buffer) |
| 1449 | (let ((info-list) | 1478 | ;; List installed packages |
| 1450 | name desc hold | 1479 | (dolist (elt package-alist) |
| 1451 | builtin) | 1480 | (setq name (car elt)) |
| 1452 | ;; List installed packages | 1481 | (when (and (not (eq name 'emacs)) ; Hide the `emacs' package. |
| 1453 | (dolist (elt package-alist) | 1482 | (or (null package-menu-package-list) |
| 1454 | (setq name (car elt)) | 1483 | (memq name package-menu-package-list))) |
| 1455 | (when (and (not (eq name 'emacs)) ; Hide the `emacs' package. | 1484 | (setq desc (cdr elt) |
| 1456 | (or (null packages) | 1485 | hold (cadr (assq name package-load-list)) |
| 1457 | (memq name packages))) | 1486 | builtin (cdr (assq name package--builtins))) |
| 1458 | (setq desc (cdr elt) | 1487 | (setq info-list |
| 1459 | hold (cadr (assq name package-load-list)) | 1488 | (package-list-maybe-add |
| 1460 | builtin (cdr (assq name package--builtins))) | 1489 | name (package-desc-vers desc) |
| 1461 | (setq info-list | 1490 | ;; FIXME: it turns out to be tricky to see if this |
| 1462 | (package-list-maybe-add | 1491 | ;; package is presently activated. |
| 1463 | name (package-desc-vers desc) | 1492 | (cond ((stringp hold) "held") |
| 1464 | ;; FIXME: it turns out to be tricky to see if this | 1493 | ((and builtin |
| 1465 | ;; package is presently activated. | 1494 | (version-list-= |
| 1466 | (cond ((stringp hold) "held") | 1495 | (package-desc-vers builtin) |
| 1467 | ((and builtin | 1496 | (package-desc-vers desc))) |
| 1468 | (version-list-= | 1497 | "built-in") |
| 1469 | (package-desc-vers builtin) | 1498 | (t "installed")) |
| 1470 | (package-desc-vers desc))) | 1499 | (package-desc-doc desc) |
| 1471 | "built-in") | 1500 | info-list)))) |
| 1472 | (t "installed")) | 1501 | |
| 1473 | (package-desc-doc desc) | 1502 | ;; List available and disabled packages |
| 1474 | info-list)))) | 1503 | (dolist (elt package-archive-contents) |
| 1475 | 1504 | (setq name (car elt) | |
| 1476 | ;; List available and disabled packages | 1505 | desc (cdr elt) |
| 1477 | (dolist (elt package-archive-contents) | 1506 | hold (assq name package-load-list)) |
| 1478 | (setq name (car elt) | 1507 | (when (or (null package-menu-package-list) |
| 1479 | desc (cdr elt) | 1508 | (memq name package-menu-package-list)) |
| 1480 | hold (assq name package-load-list)) | 1509 | (setq info-list |
| 1481 | (when (or (null packages) | 1510 | (package-list-maybe-add name |
| 1482 | (memq name packages)) | 1511 | (package-desc-vers desc) |
| 1483 | (setq info-list | 1512 | (if (and hold (null (cadr hold))) |
| 1484 | (package-list-maybe-add name | 1513 | "disabled" |
| 1485 | (package-desc-vers desc) | 1514 | "available") |
| 1486 | (if (and hold (null (cadr hold))) | 1515 | (package-desc-doc (cdr elt)) |
| 1487 | "disabled" | 1516 | info-list)))) |
| 1488 | "available") | 1517 | ;; List obsolete packages |
| 1489 | (package-desc-doc (cdr elt)) | 1518 | (mapc (lambda (elt) |
| 1490 | info-list)))) | 1519 | (mapc (lambda (inner-elt) |
| 1491 | ;; List obsolete packages | 1520 | (setq info-list |
| 1492 | (mapc (lambda (elt) | 1521 | (package-list-maybe-add (car elt) |
| 1493 | (mapc (lambda (inner-elt) | 1522 | (package-desc-vers |
| 1494 | (setq info-list | 1523 | (cdr inner-elt)) |
| 1495 | (package-list-maybe-add (car elt) | 1524 | "obsolete" |
| 1496 | (package-desc-vers | 1525 | (package-desc-doc |
| 1497 | (cdr inner-elt)) | 1526 | (cdr inner-elt)) |
| 1498 | "obsolete" | 1527 | info-list))) |
| 1499 | (package-desc-doc | 1528 | (cdr elt))) |
| 1500 | (cdr inner-elt)) | 1529 | package-obsolete-alist) |
| 1501 | info-list))) | 1530 | |
| 1502 | (cdr elt))) | 1531 | (setq info-list |
| 1503 | package-obsolete-alist) | 1532 | (sort info-list |
| 1504 | 1533 | (cond ((string= package-menu-sort-key "Package") | |
| 1505 | (setq info-list | 1534 | 'package-menu--name-predicate) |
| 1506 | (sort info-list | 1535 | ((string= package-menu-sort-key "Version") |
| 1507 | (cond ((string= package-menu-sort-key "Version") | 1536 | 'package-menu--version-predicate) |
| 1508 | 'package-menu--version-predicate) | 1537 | ((string= package-menu-sort-key "Description") |
| 1509 | ((string= package-menu-sort-key "Status") | 1538 | 'package-menu--description-predicate) |
| 1510 | 'package-menu--status-predicate) | 1539 | (t ; By default, sort by package status |
| 1511 | ((string= package-menu-sort-key "Description") | 1540 | 'package-menu--status-predicate)))) |
| 1512 | 'package-menu--description-predicate) | 1541 | |
| 1513 | (t ; Sort by package name by default | 1542 | (dolist (elt info-list) |
| 1514 | 'package-menu--name-predicate)))) | 1543 | (package-print-package (car (car elt)) |
| 1515 | 1544 | (cdr (car elt)) | |
| 1516 | (dolist (elt info-list) | 1545 | (car (cdr elt)) |
| 1517 | (package-print-package (car (car elt)) | 1546 | (car (cdr (cdr elt))))) |
| 1518 | (cdr (car elt)) | ||
| 1519 | (car (cdr elt)) | ||
| 1520 | (car (cdr (cdr elt)))))) | ||
| 1521 | (goto-char (point-min)) | 1547 | (goto-char (point-min)) |
| 1522 | (set-buffer-modified-p nil) | 1548 | (set-buffer-modified-p nil) |
| 1523 | (current-buffer))) | 1549 | (current-buffer))) |
| 1524 | 1550 | ||
| 1525 | (defun package-menu--version-predicate (left right) | 1551 | (defun package-menu--version-predicate (left right) |
| 1526 | (let ((vleft (cdr (car left))) | 1552 | (let ((vleft (or (cdr (car left)) '(0))) |
| 1527 | (vright (cdr (car right)))) | 1553 | (vright (or (cdr (car right)) '(0)))) |
| 1528 | (if (version-list-= vleft right) | 1554 | (if (version-list-= vleft vright) |
| 1529 | (package-menu--name-predicate left right) | 1555 | (package-menu--name-predicate left right) |
| 1530 | (version-list-< left right)))) | 1556 | (version-list-< vleft vright)))) |
| 1531 | 1557 | ||
| 1532 | (defun package-menu--status-predicate (left right) | 1558 | (defun package-menu--status-predicate (left right) |
| 1533 | (let ((sleft (cadr left)) | 1559 | (let ((sleft (cadr left)) |
| @@ -1558,53 +1584,28 @@ Emacs." | |||
| 1558 | (symbol-name (caar right)))) | 1584 | (symbol-name (caar right)))) |
| 1559 | 1585 | ||
| 1560 | (defun package-menu-sort-by-column (&optional e) | 1586 | (defun package-menu-sort-by-column (&optional e) |
| 1561 | "Sort the package menu by the last column clicked on." | 1587 | "Sort the package menu by the column of the mouse click E." |
| 1562 | (interactive "e") | 1588 | (interactive "e") |
| 1563 | (if e (mouse-select-window e)) | ||
| 1564 | (let* ((pos (event-start e)) | 1589 | (let* ((pos (event-start e)) |
| 1565 | (obj (posn-object pos)) | 1590 | (obj (posn-object pos)) |
| 1566 | (col (if obj | 1591 | (col (if obj |
| 1567 | (get-text-property (cdr obj) 'column-name (car obj)) | 1592 | (get-text-property (cdr obj) 'column-name (car obj)) |
| 1568 | (get-text-property (posn-point pos) 'column-name))) | 1593 | (get-text-property (posn-point pos) 'column-name))) |
| 1569 | (inhibit-read-only t)) | 1594 | (buf (window-buffer (posn-window (event-start e))))) |
| 1570 | (setq package-menu-sort-key col) | 1595 | (with-current-buffer buf |
| 1571 | (package--generate-package-list))) | 1596 | (when (eq major-mode 'package-menu-mode) |
| 1597 | (setq package-menu-sort-key col) | ||
| 1598 | (package--generate-package-list))))) | ||
| 1572 | 1599 | ||
| 1573 | (defun package--list-packages (&optional packages) | 1600 | (defun package--list-packages (&optional packages) |
| 1574 | "Display the properties of PACKAGES. | 1601 | "Generate and pop to the *Packages* buffer. |
| 1575 | PACKAGES should be a list of package names (symbols). | 1602 | Optional PACKAGES is a list of names of packages (symbols) to |
| 1576 | If PACKAGES is nil, display all packages in `package-alist'." | 1603 | list; the default is to display everything in `package-alist'." |
| 1577 | (with-current-buffer (package--generate-package-list packages) | 1604 | (with-current-buffer (get-buffer-create "*Packages*") |
| 1578 | (package-menu-mode) | 1605 | (package-menu-mode) |
| 1579 | ;; Set up the header line. | 1606 | (set (make-local-variable 'package-menu-package-list) packages) |
| 1580 | (setq header-line-format | 1607 | (set (make-local-variable 'package-menu-sort-key) nil) |
| 1581 | (mapconcat | 1608 | (package--generate-package-list) |
| 1582 | (lambda (pair) | ||
| 1583 | (let ((column (car pair)) | ||
| 1584 | (name (cdr pair))) | ||
| 1585 | (concat | ||
| 1586 | ;; Insert a space that aligns the button properly. | ||
| 1587 | (propertize " " 'display (list 'space :align-to column) | ||
| 1588 | 'face 'fixed-pitch) | ||
| 1589 | ;; Set up the column button. | ||
| 1590 | (if (string= name "Version") | ||
| 1591 | name | ||
| 1592 | (propertize name | ||
| 1593 | 'column-name name | ||
| 1594 | 'help-echo "mouse-1: sort by column" | ||
| 1595 | 'mouse-face 'highlight | ||
| 1596 | 'keymap package-menu-sort-button-map))))) | ||
| 1597 | ;; We take a trick from buff-menu and have a dummy leading | ||
| 1598 | ;; space to align the header line with the beginning of the | ||
| 1599 | ;; text. This doesn't really work properly on Emacs 21, | ||
| 1600 | ;; but it is close enough. | ||
| 1601 | '((0 . "") | ||
| 1602 | (2 . "Package") | ||
| 1603 | (20 . "Version") | ||
| 1604 | (32 . "Status") | ||
| 1605 | (43 . "Description")) | ||
| 1606 | "")) | ||
| 1607 | |||
| 1608 | ;; It's okay to use pop-to-buffer here. The package menu buffer | 1609 | ;; It's okay to use pop-to-buffer here. The package menu buffer |
| 1609 | ;; has keybindings, and the user just typed `M-x list-packages', | 1610 | ;; has keybindings, and the user just typed `M-x list-packages', |
| 1610 | ;; suggesting that they might want to use them. | 1611 | ;; suggesting that they might want to use them. |
| @@ -1617,7 +1618,6 @@ Fetches the updated list of packages before displaying. | |||
| 1617 | The list is displayed in a buffer named `*Packages*'." | 1618 | The list is displayed in a buffer named `*Packages*'." |
| 1618 | (interactive) | 1619 | (interactive) |
| 1619 | (package-refresh-contents) | 1620 | (package-refresh-contents) |
| 1620 | (setq package-menu-sort-key "Status") | ||
| 1621 | (package--list-packages)) | 1621 | (package--list-packages)) |
| 1622 | 1622 | ||
| 1623 | ;;;###autoload | 1623 | ;;;###autoload |
diff --git a/lisp/finder.el b/lisp/finder.el index 0e16b9aa44a..0c12a08d104 100644 --- a/lisp/finder.el +++ b/lisp/finder.el | |||
| @@ -32,10 +32,8 @@ | |||
| 32 | 32 | ||
| 33 | (require 'package) | 33 | (require 'package) |
| 34 | (require 'lisp-mnt) | 34 | (require 'lisp-mnt) |
| 35 | (require 'find-func) ;for find-library(-suffixes) | 35 | (require 'find-func) ;for find-library(-suffixes) |
| 36 | ;; Use `load' rather than `require' so that it doesn't get loaded | 36 | (require 'finder-inf nil t) |
| 37 | ;; during byte-compilation (at which point it might be missing). | ||
| 38 | (load "finder-inf" t t) | ||
| 39 | 37 | ||
| 40 | ;; These are supposed to correspond to top-level customization groups, | 38 | ;; These are supposed to correspond to top-level customization groups, |
| 41 | ;; says rms. | 39 | ;; says rms. |
| @@ -234,17 +232,10 @@ from; the default is `load-path'." | |||
| 234 | (search-backward "") | 232 | (search-backward "") |
| 235 | (insert "(setq package--builtins '(\n") | 233 | (insert "(setq package--builtins '(\n") |
| 236 | (dolist (package package--builtins) | 234 | (dolist (package package--builtins) |
| 237 | (insert " (") | 235 | (insert " ") |
| 238 | (prin1 (car package) (current-buffer)) | 236 | (prin1 package (current-buffer)) |
| 239 | (insert " .\n [") | 237 | (insert "\n")) |
| 240 | (let ((desc (cdr package))) | 238 | (insert "))\n\n") |
| 241 | (prin1 (aref desc 0) (current-buffer)) | ||
| 242 | (insert " ") | ||
| 243 | (prin1 (aref desc 1) (current-buffer)) | ||
| 244 | (insert " ") | ||
| 245 | (prin1 (aref desc 2) (current-buffer))) | ||
| 246 | (insert "])\n")) | ||
| 247 | (insert " ))\n\n") | ||
| 248 | ;; Insert hash table. | 239 | ;; Insert hash table. |
| 249 | (insert "(setq finder-keywords-hash\n ") | 240 | (insert "(setq finder-keywords-hash\n ") |
| 250 | (prin1 finder-keywords-hash (current-buffer)) | 241 | (prin1 finder-keywords-hash (current-buffer)) |
| @@ -325,7 +316,6 @@ not `finder-known-keywords'." | |||
| 325 | (packages (gethash id finder-keywords-hash))) | 316 | (packages (gethash id finder-keywords-hash))) |
| 326 | (unless packages | 317 | (unless packages |
| 327 | (error "No packages matching key `%s'" key)) | 318 | (error "No packages matching key `%s'" key)) |
| 328 | (setq package-menu-sort-key nil) | ||
| 329 | (package--list-packages packages))) | 319 | (package--list-packages packages))) |
| 330 | 320 | ||
| 331 | (define-button-type 'finder-xref 'action #'finder-goto-xref) | 321 | (define-button-type 'finder-xref 'action #'finder-goto-xref) |
diff --git a/lisp/hfy-cmap.el b/lisp/hfy-cmap.el index 0eff90d2298..7aefc36224b 100644 --- a/lisp/hfy-cmap.el +++ b/lisp/hfy-cmap.el | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | ;; Description: fallback code for colour name -> rgb mapping | 13 | ;; Description: fallback code for colour name -> rgb mapping |
| 14 | ;; URL: http://rtfm.etla.org/emacs/htmlfontify/ | 14 | ;; URL: http://rtfm.etla.org/emacs/htmlfontify/ |
| 15 | ;; Last-Updated: Sat 2003-02-15 03:49:32 +0000 | 15 | ;; Last-Updated: Sat 2003-02-15 03:49:32 +0000 |
| 16 | ;; Package: htmlfontify | ||
| 16 | 17 | ||
| 17 | ;; This file is part of GNU Emacs. | 18 | ;; This file is part of GNU Emacs. |
| 18 | 19 | ||
diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 244308c4d0f..02e43ef3f0c 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | ;; Keywords: wp, print, PostScript | 13 | ;; Keywords: wp, print, PostScript |
| 14 | ;; Version: 7.3.5 | 14 | ;; Version: 7.3.5 |
| 15 | ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre | 15 | ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre |
| 16 | ;; Package: ps-print | ||
| 17 | 16 | ||
| 18 | (defconst ps-print-version "7.3.5" | 17 | (defconst ps-print-version "7.3.5" |
| 19 | "ps-print.el, v 7.3.5 <2009/12/23 vinicius> | 18 | "ps-print.el, v 7.3.5 <2009/12/23 vinicius> |