unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: byte-compile warning position on certain .el
       [not found]   ` <877isvocrj.fsf@zip.com.au>
@ 2007-04-05 23:13     ` Richard Stallman
  0 siblings, 0 replies; only message in thread
From: Richard Stallman @ 2007-04-05 23:13 UTC (permalink / raw)
  To: emacs-devel; +Cc: Kevin Ryde

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-04-05 23:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87ejnb5vmd.fsf@zip.com.au>
     [not found] ` <E1HY7ok-0002hj-DZ@fencepost.gnu.org>
     [not found]   ` <877isvocrj.fsf@zip.com.au>
2007-04-05 23:13     ` byte-compile warning position on certain .el Richard Stallman

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).