~siretart/ubuntu/utopic/emacs-goodies-el/bug.1369333

« back to all changes in this revision

Viewing changes to elisp/debian-el/apt-utils.el

  • Committer: Bazaar Package Importer
  • Author(s): Peter S Galbraith
  • Date: 2011-06-24 12:37:31 UTC
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20110624123731-ktwzcwwjsa66c46g
Tags: 34.2
* emacs-goodies-el:
- session.el updated to V2.3, thanks to Christoph Wedler.
- graphviz-dot-mode.el updated to V0.3.6, thanks to Pander.
- home-end.el, new upstream version. "home-end-home and home-end-end get
  confused inside keyboard macros", thanks to Dima Kogan
  (Closes: #614327).
- maplev.texi: Updated from http://www.mapleprimes.com/files/84_maplev.zip
  and added (without patching) "@dircategory Emacs", thanks to
  Christophe Jarry (Closes: #609677).
* debian-el:
- apt-utils-el: Bug fix: "Apt-util.el doesn't know about
  Description-fr", thanks to Remi Vanicat (Closes: #613778).
  Patch applied without consulting Matt; Hope that's okay!

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
;;; Copyright (C) 2002-2010 Matthew P. Hodges
4
4
 
5
5
;; Author: Matthew P. Hodges <MPHodges@member.fsf.org>
6
 
;;      $Id: apt-utils.el,v 1.18 2010-06-23 15:03:39 mphodges-guest Exp $
 
6
;;      $Id: apt-utils.el,v 1.22 2011-06-24 16:34:46 psg Exp $
7
7
 
8
8
;; apt-utils.el is free software; you can redistribute it and/or
9
9
;; modify it under the terms of the GNU General Public License as
165
165
  "Face used for APT normal package hyperlinks."
166
166
  :group 'apt-utils)
167
167
 
 
168
(defface apt-utils-normal-installed-package-face
 
169
  '((((class color))
 
170
     (:inherit apt-utils-normal-package-face :bold t)))
 
171
  "Face used for APT installed package hyperlinks."
 
172
  :group 'apt-utils)
 
173
 
168
174
(defface apt-utils-virtual-package-face
169
175
  '((((class color) (background light))
170
176
     (:foreground "green4"))
377
383
    (let ((inhibit-read-only t))
378
384
      (erase-buffer)
379
385
      (cond
380
 
       ((equal type 'normal)
 
386
       ((memq type '(normal normal-installed))
381
387
        (call-process apt-utils-apt-cache-program nil '(t nil) nil "show" package)
382
388
        ;; Remove old versions if not wanted
383
389
        (unless apt-utils-show-all-versions
449
455
    (when (equal files '("/."))
450
456
      (setq files nil))
451
457
    (cond
452
 
     ((memq type '(normal normal-showpkg))
 
458
     ((memq type '(normal normal-showpkg normal-installed))
453
459
      (if files
454
460
          (progn
455
461
            ;; Some versions of Emacs won't update dired for the same
681
687
        (type (cdar apt-utils-package-history))
682
688
        posns)
683
689
    (cond
684
 
     ((equal type 'normal)
 
690
     ((memq type '(normal normal-installed))
685
691
      (setq posns (apt-utils-update-buffer-positions 'toggle))
686
692
      (setq apt-utils-package-history
687
693
            (cons (cons package 'normal-showpkg)
712
718
(defun apt-utils-toggle-package-p ()
713
719
  "Return non-nil if we can toggle between package and showpkg.
714
720
See also `apt-utils-toggle-package-info'."
715
 
  (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
721
  (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
716
722
 
717
723
(defun apt-utils-check-package-lists ()
718
724
  "Determine whether package lists need rebuilding."
740
746
  (cond
741
747
   ((not (equal major-mode 'apt-utils-mode))
742
748
    (message "Not in APT utils buffer."))
743
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
749
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
744
750
    (message "Not a normal package."))
745
751
   (t
746
752
    (let* ((package (caar apt-utils-package-history))
767
773
  (cond
768
774
   ((not (equal major-mode 'apt-utils-mode))
769
775
    (message "Not in APT utils buffer."))
770
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
776
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
771
777
    (message "Not a normal package."))
772
778
   (t
773
779
    (let* ((package (caar apt-utils-package-history))
794
800
  (cond
795
801
   ((not (equal major-mode 'apt-utils-mode))
796
802
    (message "Not in APT utils buffer."))
797
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
803
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
798
804
    (message "Not a normal package."))
799
805
   (t
800
806
    (let* ((package (caar apt-utils-package-history))
821
827
  (cond
822
828
   ((not (equal major-mode 'apt-utils-mode))
823
829
    (message "Not in APT utils buffer."))
824
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
830
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
825
831
    (message "Not a normal package."))
826
832
   (t
827
833
    (let* ((package (caar apt-utils-package-history))
848
854
  (cond
849
855
   ((not (equal major-mode 'apt-utils-mode))
850
856
    (message "Not in APT utils buffer."))
851
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
857
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
852
858
    (message "Not a normal package."))
853
859
   (t
854
860
    (let* ((package (caar apt-utils-package-history))
875
881
  (cond
876
882
   ((not (equal major-mode 'apt-utils-mode))
877
883
    (message "Not in APT utils buffer."))
878
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
884
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
879
885
    (message "Not a normal package."))
880
886
   (t
881
887
    (let* ((package (caar apt-utils-package-history))
902
908
  (cond
903
909
   ((not (equal major-mode 'apt-utils-mode))
904
910
    (message "Not in APT utils buffer."))
905
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
911
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
906
912
    (message "Not a normal package."))
907
913
   (t
908
914
    (let* ((package (caar apt-utils-package-history))
929
935
  (cond
930
936
   ((not (equal major-mode 'apt-utils-mode))
931
937
    (message "Not in APT utils buffer."))
932
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
938
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
933
939
    (message "Not a normal package."))
934
940
   (t
935
941
    (let ((package (caar apt-utils-package-history))
972
978
  (cond
973
979
   ((not (equal major-mode 'apt-utils-mode))
974
980
    (message "Not in APT utils buffer."))
975
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
981
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
976
982
    (message "Not a normal package."))
977
983
   (t
978
984
    (let ((package (caar apt-utils-package-history))
1008
1014
  (interactive)
1009
1015
  (let ((package (caar apt-utils-package-history))
1010
1016
        (type (cdar apt-utils-package-history)))
1011
 
    (if (memq type '(normal normal-showpkg))
 
1017
    (if (memq type '(normal normal-showpkg normal-installed))
1012
1018
        (let ((info (apt-utils-get-installed-info package)))
1013
1019
          (if info
1014
1020
              (message (apply #'format
1287
1293
              (apt-utils-puthash (buffer-substring (apt-utils-line-beginning-position)
1288
1294
                                                   (apt-utils-line-end-position))
1289
1295
                                 'normal apt-utils-package-list)
1290
 
              (forward-line 1)))
 
1296
              (forward-line 1))
 
1297
            ;; Installed packages
 
1298
            (erase-buffer)
 
1299
            (call-process apt-utils-dpkg-program nil t nil "-l")
 
1300
            (goto-char (point-min))
 
1301
            (let (package)
 
1302
              (while (not (eobp))
 
1303
                (when (looking-at "^ii")
 
1304
                  (setq package
 
1305
                        (nth 1 (split-string (buffer-substring
 
1306
                                              (apt-utils-line-beginning-position)
 
1307
                                              (apt-utils-line-end-position))
 
1308
                                             "\\s-+")))
 
1309
                  (apt-utils-puthash package
 
1310
                                     'normal-installed
 
1311
                                     apt-utils-package-list))
 
1312
                (forward-line 1))))
1291
1313
          (message "Building Debian package lists...done.")
1292
1314
          (setq apt-utils-package-list-built (current-time))
1293
1315
          (apt-utils-update-mode-name))
1401
1423
            (cond
1402
1424
             ((equal (apt-utils-package-type package t) 'normal)
1403
1425
              (setq face 'apt-utils-normal-package-face))
 
1426
             ((equal (apt-utils-package-type package t) 'normal-installed)
 
1427
              (setq face 'apt-utils-normal-installed-package-face))
1404
1428
             ((equal (apt-utils-package-type package t) 'virtual)
1405
1429
              (setq face 'apt-utils-virtual-package-face))
1406
1430
             (t
1431
1455
              (apt-utils-insert-installed-info package))
1432
1456
            (skip-chars-forward ", |\n")
1433
1457
            (setq packages (cdr packages)))))
1434
 
       ((equal match "Description")
 
1458
       ((string-match-p "Description\\(-..\\)?" match)
1435
1459
        (add-text-properties (point)
1436
1460
                             (save-excursion
1437
1461
                               (or
1477
1501
              (cond
1478
1502
               ((equal (apt-utils-package-type link t) 'normal)
1479
1503
                (setq face 'apt-utils-normal-package-face))
 
1504
               ((equal (apt-utils-package-type package t) 'normal-installed)
 
1505
                (setq face 'apt-utils-normal-installed-package-face))
1480
1506
               ((equal (apt-utils-package-type link t) 'virtual)
1481
1507
                (setq face 'apt-utils-virtual-package-face))
1482
1508
               (t
1491
1517
          (forward-line))))
1492
1518
      (setq keywords (cdr keywords))))
1493
1519
  (when (and apt-utils-display-installed-status
1494
 
             (eq (apt-utils-package-type package t) 'normal))
 
1520
             (memq (apt-utils-package-type package t)
 
1521
                   '(normal normal-installed)))
1495
1522
    (goto-char (point-min))
1496
1523
    (re-search-forward "Package: .*$")
1497
1524
    (apt-utils-insert-installed-info package)))
1528
1555
      (cond
1529
1556
       ((equal (apt-utils-package-type link t) 'normal)
1530
1557
        (setq face 'apt-utils-normal-package-face))
 
1558
       ((equal (apt-utils-package-type link t) 'normal-installed)
 
1559
        (setq face 'apt-utils-normal-installed-package-face))
1531
1560
       ((equal (apt-utils-package-type link t) 'virtual)
1532
1561
        (setq face 'apt-utils-virtual-package-face))
1533
1562
       (t
1803
1832
  (cond
1804
1833
   ((not (equal major-mode 'apt-utils-mode))
1805
1834
    (message "Not in APT utils buffer."))
1806
 
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg)))
 
1835
   ((not (memq (cdar apt-utils-package-history) '(normal normal-showpkg normal-installed)))
1807
1836
    (message "Not a normal package."))
1808
1837
   (t
1809
1838
    (browse-url (apt-utils-web-format-url url)))))
1822
1851
    (save-excursion                     ; for normal package type
1823
1852
      (with-temp-buffer
1824
1853
        (cond
1825
 
         ((eq type 'normal)
 
1854
         ((memq type '(normal normal-installed))
1826
1855
          (set-buffer buffer))
1827
1856
         ((eq type 'normal-showpkg)
1828
1857
          (call-process apt-utils-apt-cache-program nil '(t nil) nil "show" package)))