comparison lisp/net/goto-addr.el @ 37423:3ab2c865a8e5

Instead of defining line-beginning-position and line-end-position a defalias is used for point-at-bol and point-at-eol. Added XEmacs compatibility code. (goto-address-highlight-keymap): Made keybindings XEmacs compatible.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 23 Apr 2001 10:16:54 +0000
parents 42ce5997aa4a
children 5bc4eff5115e
comparison
equal deleted inserted replaced
37422:98ffe6c6b815 37423:3ab2c865a8e5
1 ;;; goto-addr.el --- click to browse URL or to send to e-mail address 1 ;;; goto-addr.el --- click to browse URL or to send to e-mail address
2 2
3 ;; Copyright (C) 1995, 2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 1995, 2000, 2001 Free Software Foundation, Inc.
4 4
5 ;; Author: Eric Ding <ericding@alum.mit.edu> 5 ;; Author: Eric Ding <ericding@alum.mit.edu>
6 ;; Maintainer: FSF 6 ;; Maintainer: FSF
7 ;; Created: 15 Aug 1995 7 ;; Created: 15 Aug 1995
8 ;; Keywords: mh-e, www, mouse, mail 8 ;; Keywords: mh-e, www, mouse, mail
62 ;;; Code: 62 ;;; Code:
63 63
64 (require 'thingatpt) 64 (require 'thingatpt)
65 (autoload 'browse-url-url-at-point "browse-url") 65 (autoload 'browse-url-url-at-point "browse-url")
66 66
67 ;; XEmacs needs the following definitions.
68 (unless (fboundp 'overlays-in)
69 (require 'overlay))
70 (unless (fboundp 'line-beginning-position)
71 (defalias 'line-beginning-position 'point-at-bol))
72 (unless (fboundp 'line-end-position)
73 (defalias 'line-end-position 'point-at-eol))
74 (unless (fboundp 'match-string-no-properties)
75 (defalias 'match-string-no-properties 'match-string))
76
67 (defgroup goto-address nil 77 (defgroup goto-address nil
68 "Click to browse URL or to send to e-mail address." 78 "Click to browse URL or to send to e-mail address."
69 :group 'mouse 79 :group 'mouse
70 :group 'hypermedia) 80 :group 'hypermedia)
71 81
98 ;;; "[-a-zA-Z0-9_=#$@~`%&*+|\\/]") 108 ;;; "[-a-zA-Z0-9_=#$@~`%&*+|\\/]")
99 "A regular expression probably matching a URL.") 109 "A regular expression probably matching a URL.")
100 110
101 (defvar goto-address-highlight-keymap 111 (defvar goto-address-highlight-keymap
102 (let ((m (make-sparse-keymap))) 112 (let ((m (make-sparse-keymap)))
103 (define-key m [mouse-2] 'goto-address-at-mouse) 113 (if (featurep 'xemacs)
104 (define-key m "\C-c\r" 'goto-address-at-point) 114 (define-key m (kbd "<button2>") 'goto-address-at-mouse)
115 (define-key m (kbd "<mouse-2>") 'goto-address-at-mouse))
116 (define-key m (kbd "C-c RET") 'goto-address-at-point)
105 m) 117 m)
106 "keymap to hold goto-addr's mouse key defs under highlighted URLs.") 118 "keymap to hold goto-addr's mouse key defs under highlighted URLs.")
107 119
108 (defcustom goto-address-url-face 'bold 120 (defcustom goto-address-url-face 'bold
109 "Face to use for URLs." 121 "Face to use for URLs."