emacs-devel
[Top][All Lists]
Advanced

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

Re: byte-compile warning position on certain .el


From: Richard Stallman
Subject: Re: byte-compile warning position on certain .el
Date: Thu, 05 Apr 2007 19:13:26 -0400

I simplifiedd Kevin's test case, to produce this single file.  Do
emacs -Q, then M-x byte-compile on this file, and several of the
warnings are listed as many lines away from their actual locations.

I wish I had time to debug this, but I don't.  Would someone else
please debug it, and fix it if possible?



;; dictionary.el -- an interface to RFC 2229 dictionary server

;; Author: Torsten Hilbrich <address@hidden>
;; Keywords: interface, dictionary
;; $Id: dictionary.el 338 2004-10-02 06:04:54Z torsten $

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

(defconst dictionary-use-balloon-help 
  (eval-when-compile
    (condition-case nil
        (require 'balloon-help)
      (error nil))))

(if dictionary-use-balloon-help
    (progn

;; The following definition are only valid for XEmacs with balloon-help 

(defvar dictionary-balloon-help-position nil
  "Current position to lookup word")

(defun dictionary-balloon-help-store-position (event)
  (setq dictionary-balloon-help-position (event-point event)))

(defun dictionary-balloon-help-description (&rest extent)
  "Get the word from the cursor and lookup it"
  (if dictionary-balloon-help-position
      (let ((word (save-window-excursion
                    (save-excursion
                      (goto-char dictionary-balloon-help-position)
                      (current-word)))))
        (let ((definition
                (dictionary-definition word dictionary-tooltip-dictionary)))
          (if definition
              (dictionary-decode-charset definition
                                         dictionary-tooltip-dictionary)
            nil)))))

(defvar dictionary-balloon-help-extent nil
  "The extent for activating the balloon help")

(make-variable-buffer-local 'dictionary-balloon-help-extent)

;;;###autoload
(defun dictionary-tooltip-mode (&optional arg)
   "Display tooltips for the current word"
   (interactive "P")
   (let* ((on (if arg
                  (> (prefix-numeric-value arg) 0)
                (not dictionary-tooltip-mode))))
     (make-local-variable 'dictionary-tooltip-mode)
     (if on
         ;; active mode
         (progn
           ;; remove old extend
           (if dictionary-balloon-help-extent
               (delete-extent dictionary-balloon-help-extent))
           ;; create new one
           (setq dictionary-balloon-help-extent (make-extent (point-min)
                                                             (point-max)))
           (set-extent-property dictionary-balloon-help-extent
                                'balloon-help 
                                'dictionary-balloon-help-description)
           (set-extent-property dictionary-balloon-help-extent
                                'start-open nil)
           (set-extent-property dictionary-balloon-help-extent
                                'end-open nil)
           (add-hook 'mouse-motion-hook
                     'dictionary-balloon-help-store-position))

       ;; deactivate mode
       (if dictionary-balloon-help-extent
           (delete-extent dictionary-balloon-help-extent))
       (remove-hook 'mouse-motion-hook
                     'dictionary-balloon-help-store-position))
     (setq dictionary-tooltip-mode on)
     (balloon-help-minor-mode on)))

) ;; end of XEmacs part

(defvar global-dictionary-tooltip-mode
  nil)

;;; Tooltip support for GNU Emacs
(defun dictionary-display-tooltip (event)
  "Search the current word in the `dictionary-tooltip-dictionary'."
  (interactive "e")
  (if dictionary-tooltip-dictionary
      (let ((word (save-window-excursion
                    (save-excursion
                      (mouse-set-point event)
                      (current-word)))))
        (let ((definition 
                (dictionary-definition word dictionary-tooltip-dictionary)))
          (if definition 
              (tooltip-show 
               (dictionary-decode-charset definition 
                                          dictionary-tooltip-dictionary)))
          t))
    nil))

;;;###autoload
(defun dictionary-tooltip-mode (&optional arg)
  "Display tooltips for the current word"
  (interactive "P")
  (require 'tooltip)
  (let ((on (if arg
                (> (prefix-numeric-value arg) 0)
              (not dictionary-tooltip-mode))))
    (make-local-variable 'dictionary-tooltip-mode)
    (setq dictionary-tooltip-mode on)
    ;; make sure that tooltip is still (global available) even is on
    ;; if nil
    (tooltip-mode 1)
    (add-hook 'tooltip-hook 'dictionary-display-tooltip)
    (make-local-variable 'track-mouse)
    (setq track-mouse on)))

;;;###autoload
(defun global-dictionary-tooltip-mode (&optional arg)
  "Enable/disable dictionary-tooltip-mode for all buffers"
  (interactive "P")
  (require 'tooltip)
  (let* ((on (if arg (> (prefix-numeric-value arg) 0)
              (not global-dictionary-tooltip-mode)))
         (hook-fn (if on 'add-hook 'remove-hook)))
    (setq global-dictionary-tooltip-mode on)
    (tooltip-mode 1)
    (funcall hook-fn 'tooltip-hook 'dictionary-display-tooltip)
    (setq-default dictionary-tooltip-mode on)
    (setq-default track-mouse on)))

) ;; end of GNU Emacs part

(provide 'dictionary)




reply via email to

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