unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: emacs-devel@gnu.org
Cc: Kevin Ryde <user42@zip.com.au>
Subject: Re: byte-compile warning position on certain .el
Date: Thu, 05 Apr 2007 19:13:26 -0400	[thread overview]
Message-ID: <E1HZb8w-00033K-8G@fencepost.gnu.org> (raw)
In-Reply-To: <877isvocrj.fsf@zip.com.au> (message from Kevin Ryde on Mon, 02 Apr 2007 10:12:16 +1000)

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 <dictionary@myrkr.in-berlin.de>
;; 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	other threads:[~2007-04-05 23:13 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <877isvocrj.fsf@zip.com.au>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1HZb8w-00033K-8G@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=user42@zip.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).