emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: Re: Icicles, Printing and Easy Menu]


From: Vinicius Jose Latorre
Subject: Re: address@hidden: Re: Icicles, Printing and Easy Menu]
Date: Wed, 08 Nov 2006 00:00:08 -0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060910 SeaMonkey/1.0.5

Chong Yidong wrote:
Richard Stallman <address@hidden> writes:

Would one of the expert debuggers please turn attention to this issue?
We need to figure out what is happening in this simple test case.

This is because when you redefine some keys to the File Menu, the menu
keymap changes.  The result is that the changes that pr-menu-bind (in
printing.el) tries to make to the File Menu using easymenu won't
succeed.  The following patch fixes how pr-menu-bind changes the File
Menu.  It also fixes a bug where loading printing.el twice causes
pr-menu-bind to be called.

I'll check it in if there are no objections over the next couple of
days.

Well, IMHO, the problem is the easymenu api, the easy-menu-change definition:

   (defun easy-menu-change (path name items &optional before)

should be replaced by:

  (defun easy-menu-change (map path name items &optional before)

So, easy-menu-add-item receives a map instead of nil.

In the tests that I've done, all works if the map parameter is specified in
easy-menu-remove-item and in easy-menu-add-item calling,
instead of given a nil value. To fix the problem, just pass "global-map" as
the map parameter.

Also, the patch that was done in printing.el doesn't work for Emacs 21
running in GNU/Linux, the problem still persists. I've made some
modifications in the patch.

Also, there wasn't a bug when printing.el was loaded twice or more times.
The variable pr-menu-print-item only deals with the interaction between
pr-menu-bind and pr-update-menus functions, that is, no other function
should be involved in the process.

The problem in printing.el only happens when "Print" submenu is not created.

The patch below fix the problem in Emacs 21 & 22.


Vinicius


*** emacs/lisp/printing.el.~1.38.~    2006-11-06 16:01:42.000000000 -0200
--- emacs/lisp/printing.el    2006-11-07 23:20:14.000000000 -0200
***************
*** 5,11 ****

 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
! ;; Time-stamp: <2006/09/15 18:53:14 vinicius>
 ;; Keywords: wp, print, PostScript
 ;; Version: 6.8.4
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
--- 5,11 ----

 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
! ;; Time-stamp: <2006/11/07 23:20:14 vinicius>
 ;; Keywords: wp, print, PostScript
 ;; Version: 6.8.4
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
***************
*** 68,74 ****
 ;; interface to ps-print package and it also provides some extra stuff.
 ;;
 ;; To download the latest ps-print package see
! ;; `http://www.cpqd.com.br/~vinicius/emacs/ps-print.tar.gz'.
 ;; Please, see README file for ps-print installation instructions.
 ;;
 ;; `printing' was inspired on:
--- 68,74 ----
 ;; interface to ps-print package and it also provides some extra stuff.
 ;;
 ;; To download the latest ps-print package see
! ;; `http://www.emacswiki.org/cgi-bin/emacs/download/ps-print.tar.gz'.
 ;; Please, see README file for ps-print installation instructions.
 ;;
 ;; `printing' was inspired on:
***************
*** 958,965 ****
 ;;
 ;; * For `printing' package:
 ;;
! ;;    printing    `http://www.cpqd.com.br/~vinicius/emacs/printing.el.gz'
! ;;    ps-print    `http://www.cpqd.com.br/~vinicius/emacs/ps-print.tar.gz'
 ;;
 ;; * For GNU or Unix system:
 ;;
--- 958,965 ----
 ;;
 ;; * For `printing' package:
 ;;
! ;; printing `http://www.emacswiki.org/cgi-bin/emacs/download/printing.el' ! ;; ps-print `http://www.emacswiki.org/cgi-bin/emacs/download/ps-print.tar.gz'
 ;;
 ;; * For GNU or Unix system:
 ;;
***************
*** 1144,1150 ****
   "Set the value of custom variables for printer & utility selection."
   (set symbol value)
   (and (featurep 'printing)        ; update only after printing is loaded
-        (not pr-menu-print-item)
        (pr-update-menus t)))


--- 1144,1149 ----
***************
*** 1152,1158 ****
   "Update utility menu entry."
   (set symbol value)
   (and (featurep 'printing)        ; update only after printing is loaded
-        (not pr-menu-print-item)
        (pr-menu-set-utility-title value)))


--- 1151,1156 ----
***************
*** 1160,1166 ****
   "Update `PostScript Printer:' menu entry."
   (set symbol value)
   (and (featurep 'printing)        ; update only after printing is loaded
-        (not pr-menu-print-item)
        (pr-menu-set-ps-title value)))


--- 1158,1163 ----
***************
*** 1168,1174 ****
   "Update `Text Printer:' menu entry."
   (set symbol value)
   (and (featurep 'printing)        ; update only after printing is loaded
-        (not pr-menu-print-item)
        (pr-menu-set-txt-title value)))


--- 1165,1170 ----
***************
*** 3091,3097 ****
     ;; third... time, but "print" item exists only in the first load.
     (cond
      ;; Emacs 20
!      ((string< emacs-version "21.")
(easy-menu-change '("tools") "Printing" pr-menu-spec pr-menu-print-item)
       (when pr-menu-print-item
     (easy-menu-remove-item nil '("tools") pr-menu-print-item)
--- 3087,3093 ----
     ;; third... time, but "print" item exists only in the first load.
     (cond
      ;; Emacs 20
!      ((< emacs-major-version 21)
(easy-menu-change '("tools") "Printing" pr-menu-spec pr-menu-print-item)
       (when pr-menu-print-item
     (easy-menu-remove-item nil '("tools") pr-menu-print-item)
***************
*** 3100,3120 ****
                   (pr-get-symbol "Printing")))))
      ;; Emacs 21 & 22
      (t
!       (cond
!        (pr-menu-print-item
!     (easy-menu-add-item menu-bar-file-menu nil
!                 (easy-menu-create-menu "Print" pr-menu-spec)
!                 "print-buffer")
!     (dolist (item '("print-buffer"          "print-region"
!             "ps-print-buffer-faces" "ps-print-region-faces"
!             "ps-print-buffer"       "ps-print-region"))
!       (easy-menu-remove-item menu-bar-file-menu nil item))
!     (setq pr-menu-print-item nil
!           pr-menu-bar (vector 'menu-bar
!                   'file
!                   (pr-get-symbol "Print"))))
!        (t
!     (easy-menu-change '("file") "Print" pr-menu-spec)))))))
   (pr-update-menus t))


--- 3096,3119 ----
                   (pr-get-symbol "Printing")))))
      ;; Emacs 21 & 22
      (t
! (let ((menu-file (if (lookup-key global-map (vector 'menu-bar 'file))
!                '("menu-bar" "file")     ; Emacs 22
!              '("menu-bar" "files")))) ; Emacs 21
!     (cond
!      (pr-menu-print-item
!       (easy-menu-add-item global-map menu-file
!                   (easy-menu-create-menu "Print" pr-menu-spec)
!                   "print-buffer")
!       (dolist (item '("print-buffer"          "print-region"
!               "ps-print-buffer-faces" "ps-print-region-faces"
!               "ps-print-buffer"       "ps-print-region"))
!         (easy-menu-remove-item global-map menu-file item))
!       (setq pr-menu-print-item nil
!         pr-menu-bar (vector 'menu-bar
!                     (pr-get-symbol (nth 1 menu-file))
!                     (pr-get-symbol "Print"))))
!      (t
!       (easy-menu-change (cdr menu-file) "Print" pr-menu-spec))))))))
   (pr-update-menus t))


***************
*** 6056,6062 ****
   ;; header
   (let ((versions (concat "printing v" pr-version
               "    ps-print v" ps-print-version)))
!     (widget-insert (make-string (- 79 (length versions)) ?\s) versions))
   (pr-insert-italic "\nCurrent Directory : " 1)
   (pr-insert-italic default-directory)

--- 6055,6063 ----
   ;; header
   (let ((versions (concat "printing v" pr-version
               "    ps-print v" ps-print-version)))
!     ;; to keep compatibility with Emacs 20 & 21:
!     ;; DO NOT REPLACE `?\ ' BY `?\s'
!     (widget-insert (make-string (- 79 (length versions)) ?\ ) versions))
   (pr-insert-italic "\nCurrent Directory : " 1)
   (pr-insert-italic default-directory)


Diff finished.  Tue Nov  7 23:21:03 2006





reply via email to

[Prev in Thread] Current Thread [Next in Thread]