[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lispref/text.texi
From: |
Richard M . Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/lispref/text.texi |
Date: |
Wed, 12 Jan 2005 00:34:04 -0500 |
Index: emacs/lispref/text.texi
diff -c emacs/lispref/text.texi:1.83 emacs/lispref/text.texi:1.84
*** emacs/lispref/text.texi:1.83 Tue Jan 11 00:12:09 2005
--- emacs/lispref/text.texi Wed Jan 12 05:14:03 2005
***************
*** 3394,3450 ****
@subsection Enabling Mouse-1 to Follow Links
@cindex follow links
! Traditionally, Emacs uses a @key{mouse-1} click to set point and a
! @key{mouse-2} click to follow a link, whereas most other applications
! use a @key{mouse-1} click for both purposes, depending on whether you
! click outside or inside a link.
!
! Starting with Emacs release 21.4, the user visible behaviour of a
! @key{mouse-1} click on a link has been changed to match this
! context-sentitive dual behaviour. The user can customize this
! behaviour through the variable @code{mouse-1-click-follows-link}.
!
! However, at the Lisp level, @key{mouse-2} is still used as the
! action for the clickable text corresponding to the link, and the
! clickable text must be explicitly marked as a link for a @key{mouse-1}
! click to follow the link.
!
! There are several methods that can be used to identify a clickable
! text as a link:
@table @asis
! @item follow-link property
!
! If the clickable text has a non-nil @code{follow-link} text or overlay
property, the value of that property determines what to do.
! @item follow-link event
!
! If there is a binding for the @code{follow-link} event, either on
the clickable text or in the local keymap, the binding of that event
! determines whether the mouse click position is inside a link:
! @table @asis
! @item mouse-face
! If the binding is @code{mouse-face}, the mouse click position is
! inside a link if there is a non-nil @code{mouse-face} property at
! that position. A value of @code{t} is used to determine what to do next.
! For example, here is how @key{mouse-1} are setup in info mode:
@example
(define-key Info-mode-map [follow-link] 'mouse-face)
@end example
@item a function
! If the binding is a function, @var{func}, the mouse click position,
! @var{pos}, is inside a link if the call @code{(@var{func} @var{pos})}
! returns address@hidden The return value from that call determines
! what to do next.
!
! For example, here is how pcvs enables @key{mouse-1} on file names only:
@example
(define-key map [follow-link]
--- 3394,3447 ----
@subsection Enabling Mouse-1 to Follow Links
@cindex follow links
! The normal Emacs command for activating text in read-only buffers is
! @key{Mouse-2}, which includes following textual links. However, most
! graphical applications use @key{Mouse-1} for following links. For
! compatibility, @key{Mouse-1} follows links in Emacs too, when you
! click on a link quickly without moving the mouse. The user can
! customize this behaviour through the variable
! @code{mouse-1-click-follows-link}.
!
! To define text as a link at the Lisp level, you should bind
! @key{Mouse-2} to a command to follow the link. Then, to indicate
! that @key{Mouse-1} should also follow the link, here is what you do:
@table @asis
! @item @code{follow-link} property
! If the clickable text has a address@hidden @code{follow-link} text or overlay
property, the value of that property determines what to do.
! @item @code{follow-link} event
! If there is a binding for the @code{follow-link} event, either on
the clickable text or in the local keymap, the binding of that event
! determines whether the mouse click position is inside a link.
! @end table
! Regardless of where the @code{follow-link} value comes from, that
! value is used according to the following table to determine whether
! the given position is inside a link, and (if so) to compute an
! @dfn{action code} saying how @key{Mouse-1} should handle the link.
! @table @asis
! @item @code{mouse-face}
! If the value is @code{mouse-face}, a position is inside a link if
! there is a address@hidden @code{mouse-face} property at that position.
! The action code is always @code{t}.
! For example, here is how Info mode handles @key{Mouse-1}:
@example
(define-key Info-mode-map [follow-link] 'mouse-face)
@end example
@item a function
+ If the value is a function, @var{func}, then a position @var{pos} is
+ inside a link if @code{(@var{func} @var{pos})} evaluates to
+ address@hidden The value returned by @var{func} serves as the action
+ code.
! For example, here is how pcvs enables @key{Mouse-1} to follow links on
! file names only:
@example
(define-key map [follow-link]
***************
*** 3452,3497 ****
(if (eq (get-char-property pos 'face) 'cvs-filename-face) t)))
@end example
! @item anthing else
!
! If the binding is anything else, the binding determines what to do.
! @end table
!
@end table
@noindent
! The resulting value determined above is interpreted as follows:
@table @asis
@item a string
!
! If the value is a string, the @key{mouse-1} event is translated into
! the first character of the string, i.e. the action of the @key{mouse-1}
! click is the local or global binding of that character.
@item a vector
!
! If the value is is a vector, the @key{mouse-1} event is translated
! into the first element of that vector, i.e. the action of the
! @key{mouse-1} click is the local or global binding of that event.
!
! @item anthing else
!
! For any other non-nil valule, the @key{mouse-1} event is translated
! into a @key{mouse-2} event at the same position.
@end table
! To use @key{mouse-1} on a button defined with @code{define-button-type},
! give the button a @code{follow-link} property with a value as
! specified above to determine how to follow the link.
!
! To use @key{mouse-1} on a widget defined with @code{define-widget},
! give the widget a @code{:follow-link} property with a value
! as specified above to determine how to follow the link.
@defun mouse-on-link-p pos
@tindex mouse-on-link-p
! Return address@hidden if @var{pos} is on a link in the current buffer.
@end defun
@node Fields
--- 3449,3496 ----
(if (eq (get-char-property pos 'face) 'cvs-filename-face) t)))
@end example
! @item anything else
! If the value is anything else, it is the action code.
@end table
@noindent
! Here's how the action code determines what @key{Mouse-1} should do:
@table @asis
@item a string
! If the action code is a string, the @key{Mouse-1} event is translated
! into the first character of the string, i.e., the action of the
! @key{Mouse-1} click is the local or global binding of that character.
! Thus, if the action code is @code{"foo"}, @key{Mouse-1} translates
! into @kbd{f}.
@item a vector
! If the action code is is a vector, the @key{Mouse-1} event is
! translated into the first element of that vector, i.e,. the action of
! the @key{Mouse-1} click is the local or global binding of that event.
! Thus, if the action code is @code{[?f ?o ?o]}, @key{Mouse-1}
! translates into @kbd{f}.
!
! @item anything else
! For any other address@hidden action code, the @code{mouse-1} event is
! translated into a @code{mouse-2} event at the same position.
@end table
! To define @key{Mouse-1} to activate a button defined with
! @code{define-button-type}, give the button a @code{follow-link}
! property with a value as specified above to determine how to follow
! the link.
! @c ??? That is not clear. This needs an example or an xref.
!
! To define @key{Mouse-1} on a widget defined with
! @code{define-widget}, give the widget a @code{:follow-link} property
! with a value as specified above to determine how to follow the link.
! @c ??? That is not clear. This needs an example or an xref.
@defun mouse-on-link-p pos
@tindex mouse-on-link-p
! This function returns address@hidden if position @var{pos} in the
! current buffer is on a link.
@end defun
@node Fields
- [Emacs-diffs] Changes to emacs/lispref/text.texi, Richard M . Stallman, 2005/01/06
- [Emacs-diffs] Changes to emacs/lispref/text.texi, Kim F . Storm, 2005/01/10
- [Emacs-diffs] Changes to emacs/lispref/text.texi,
Richard M . Stallman <=
- [Emacs-diffs] Changes to emacs/lispref/text.texi, Kim F . Storm, 2005/01/12
- [Emacs-diffs] Changes to emacs/lispref/text.texi, Eli Zaretskii, 2005/01/29
- [Emacs-diffs] Changes to emacs/lispref/text.texi, Kim F . Storm, 2005/01/31
- [Emacs-diffs] Changes to emacs/lispref/text.texi, Luc Teirlinck, 2005/01/31