* FW: commands to select things of different kinds
@ 2008-03-09 16:45 Drew Adams
2008-03-10 3:32 ` Stefan Monnier
0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2008-03-09 16:45 UTC (permalink / raw)
To: Emacs-Devel
[-- Attachment #1: Type: text/plain, Size: 3710 bytes --]
Resending, at Richard's request.
> -----Original Message-----
> From: Richard Stallman Sent: Wednesday, July 18, 2007 1:54 PM
> To: Drew Adams
>
> Not really; haven't thought much about it. As I said,
> I've been using
> `C-M-SPC' for `mark-thing' (stealing from `mark-sexp')
> and `M-@' for
> `cycle-thing-region' (stealing from `mark-word').
>
> Those might be a good replacement, because I would expect people don't
> use those two bindings very much. But we have to ask people first.
> -----Original Message-----
> From: Drew Adams Sent: Tuesday, July 17, 2007 9:52 PM
> To: rms@gnu.org
>
> > > If the region is not yet active, then you are prompted (with
> > > completion) for the type of thing to select. The default type
> > > is `sexp'.
> >
> > For the first such thing, the region is not active, so you
> > are prompted. For subsequent (successive) things, there is
> > no prompt - the same type is used as the last. When you are
> > prompted, `sexp' is the default type.
> >
> > I see. Maybe it is a good idea. If people like it, we can
> install it
> > in Emacs.
> >
> > Do you have suggested bindings for these two commands?
>
> Not really; haven't thought much about it. As I said, I've
> been using `C-M-SPC' for `mark-thing' (stealing from
> `mark-sexp') and `M-@' for `cycle-thing-region' (stealing
> from `mark-word'). But, as I also said, I'm not suggesting
> changing those bindings for Emacs.
>
> I think these commands are mainly useful for Transient Mark
> mode, if that helps. Perhaps there are some bindings that
> normally make less sense in t-m mode, which could therefore
> be recuperated. I don't know.
> -----Original Message-----
> From: Drew Adams Sent: Monday, July 16, 2007 12:17 AM
> To: Emacs-Devel
>
> Any interest in these commands? They let you select (that is,
> mark) various
> things at or near point. They are most useful in Transient
> Mark mode - they
> act differently depending on whether the mark is active.
>
> * `mark-thing' selects successive things, starting at point.
> The mark is put
> at the same place that command 'forward-'thing would put it
> (using the same
> prefix argument). If the region is not yet active, then you
> are prompted
> (with completion) for the type of thing to select. The default type is
> `sexp'.
>
> * `cycle-thing-region' selects one thing at or near point
> (just the thing,
> not from point through the thing, even if the thing is not exactly at
> point). Repeat it to cycle among the thing types - one thing
> of the current
> type is selected at each invocation. The default order of
> types is `word',
> `sexp', `list', `line', `sentence', `paragraph', `page',
> `defun', `number',
> `form'. That order is customizable, and a major mode could
> also change it to
> put the most commonly used types first.
>
> I bind `mark-thing' to `C-M-SPC' as a replacement for `mark-sexp'.
>
> I bind `cycle-thing-region' to `M-@' as a replacement for
> `mark-word'. (By
> default, it does what `mark-word' does without a prefix arg. Unlike,
> `mark-thing', however, `cycle-thing-region' does not accept a
> prefix arg.)
>
> I don't propose these bindings for Emacs generally, but if you use
> transient-mark mode you might want to give them a try.
>
> To select successive things in transient-mark mode, you can use
> `cycle-thing-region' as an alternative to completion for
> choosing the thing
> type for `mark-thing' - but you need to use `C-x C-x' between
> the two. That
> is, you can use 'M-@ C-x C-x C-M-SPC' to select successive
> words, 'M-@ M-@
> C-x C-x C-M-SPC' for successive symbols, and so on.
>
> The code is attached.
[-- Attachment #2: thing-cmds.el --]
[-- Type: application/octet-stream, Size: 8042 bytes --]
;;; thing-cmds.el --- Commands that use things, as defined by `thingatpt.el'.
;;
;; Filename: thing-cmds.el
;; Description: Commands that use things, as defined by `thingatpt.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 2006-2007, Drew Adams, all rights reserved.
;; Created: Sun Jul 30 16:40:29 2006
;; Version: 20.1
;; Last-Updated: Sun Jul 15 23:58:11 2007 (-25200 Pacific Daylight Time)
;; By: dradams
;; Update #: 41
;; URL: http://www.emacswiki.org/cgi-bin/wiki/thing-cmds.el
;; Keywords: thingatpt, thing, region, selection
;; Compatibility: GNU Emacs 20.x, GNU Emacs 21.x, GNU Emacs 22.x
;;
;; Features that might be required by this library:
;;
;; `thingatpt', `thingatpt+'.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; You can use the commands defined here to select different kinds of
;; text entities ("things"). They are especially useful in
;; combination with Transient Mark mode.
;;
;; Commands defined here:
;;
;; `cycle-thing-region', `mark-thing', `select-thing-near-point',
;; `thing-region'.
;;
;; User options defined here:
;;
;; `thing-types'.
;;
;; Internal variables defined here:
;;
;; `mark-thing-type', `thing-region-index'.
;;
;; Put this in your init file (`~/.emacs'): (require 'thing-cmds)
;;
;; Suggested key bindings (these will replace the standard bindings
;; for `mark-sexp' and `mark-word'):
;;
;; (global-set-key [(control meta ? )] 'mark-thing) ; vs `mark-sexp'
;; (global-set-key [(meta ?@)] 'cycle-thing-region) ; vs `mark-word'
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change log:
;;
;; 2007/07/15 dadams
;; Added cycle-thing-region-point.
;; cycle-thing-region: Save point in cycle-thing-region-point and reuse it.
;; 2006/07/30 dadams
;; Created.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program 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 program 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 this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(require 'thingatpt+ nil t) ;; (no error if not found): bounds-of-thing-at-point
(require 'thingatpt) ;; bounds-of-thing-at-point
(when (< emacs-major-version 20) (eval-when-compile (require 'cl))) ;; when, unless
;;;;;;;;;;;;;;;;;;;;;;;;
(defun thing-region (thing)
"Set the region around a THING near the cursor.
You are prompted for the type of thing. Completion is available for
some standard types of thing, but you can enter any type.
The cursor is placed at the end of the region. You can return it to
the original location by using `C-u C-SPC' twice."
(interactive (list (let ((icicle-sort-function nil))
(completing-read "Type of thing: " (mapcar #'list thing-types)
nil nil nil nil "sexp"))))
(let* ((bds (if (fboundp 'bounds-of-thing-nearest-point) ; In `thingatpt+.el'.
(bounds-of-thing-nearest-point (intern thing))
(bounds-of-thing-at-point (intern thing))))
(start (car bds))
(end (cdr bds)))
(cond ((and start end)
(push-mark (point) t) ; Mark position, so can use `C-u C-SPC'.
(goto-char end)
(push-mark start t 'activate)
(setq deactivate-mark nil)
thing) ; Return thing.
(t
(message "No `%s' near point" thing)
(setq deactivate-mark nil)
nil)))) ; Return nil: no thing found.
(defalias 'select-thing-near-point 'cycle-thing-region)
(defun cycle-thing-region ()
"Select a thing near point. Successive uses select different things.
In Transient Mark mode, you can follow this with `\\[mark-thing]' to select
successive things of the same type, but to do that you must first use
`C-x C-x': `\\[cycle-thing-region] C-x C-x \\[mark-thing]'"
(interactive)
(if (eq last-command this-command)
(goto-char cycle-thing-region-point)
(setq thing-region-index 0)
(setq cycle-thing-region-point (point)))
(let* ((thing (elt thing-types thing-region-index))
(success (thing-region thing)))
(setq thing-region-index (1+ thing-region-index))
(when success
(setq mark-thing-type (intern thing)) ; Save it for `mark-thing'.
(message "%s" (capitalize (elt thing-types (1- thing-region-index)))))
(when (>= thing-region-index (length thing-types)) (setq thing-region-index 0))))
(defcustom thing-types '("word" "symbol" "sexp" "list" "line" "sentence"
"paragraph" "page" "defun" "number" "form")
"List of thing types. Used for completion and `cycle-thing-region'.
Each element is a string that names a type of text entity for which
there is a either a corresponding `forward-'thing operation, or
corresponding `beginning-of-'thing and `end-of-'thing operations.
Examples include \"word\", \"sentence\", and \"defun\"."
:type '(repeat string))
(defvar thing-region-index 0 "Index of current thing in `thing-types'.")
(defvar mark-thing-type nil "Current thing type used by `mark-thing'.")
(defvar cycle-thing-region-point nil
"Position of point before `cycle-thing-region'.")
(defun mark-thing (thing &optional arg allow-extend)
"Set the mark ARG THINGs from point.
THING is a string that names a type of thing: \"word\", \"sexp\", and
so on. See option `thing-types' for more examples.
The mark is put at the same place command `forward-'THING would put it
with the same prefix argument.
If the prefix argument (ARG) is negative, then point is put at the end
of the THING, amd mark is put at the beginning of the THING or a
previous THING.
Interactively:
You are prompted for THING. Completion is available for the types of
thing in `thing-types', but you can enter any type.
If `mark-thing' is repeated or if the mark is active (in Transient
Mark mode), then it marks the next ARG THINGs, after the ones already
marked."
(interactive "i\nP\np") ; THING arg is nil (ignored) interactively.
(cond ((and allow-extend (or (and (eq last-command this-command) (mark t))
(and transient-mark-mode mark-active)))
(setq arg (if arg
(prefix-numeric-value arg)
(if (< (mark) (point)) -1 1)))
(set-mark (save-excursion
(goto-char (mark))
(forward-thing mark-thing-type arg)
(point))))
(t
(setq mark-thing-type
(or thing (intern (let ((icicle-sort-function nil))
(completing-read "Type of thing: "
(mapcar #'list thing-types)
nil nil nil nil "sexp")))))
(push-mark (save-excursion
(forward-thing mark-thing-type (prefix-numeric-value arg))
(point))
nil t)))
(setq deactivate-mark nil))
;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'thing-cmds)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; thing-cmds.el ends here
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: FW: commands to select things of different kinds
2008-03-09 16:45 FW: commands to select things of different kinds Drew Adams
@ 2008-03-10 3:32 ` Stefan Monnier
2008-03-10 4:30 ` Drew Adams
0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2008-03-10 3:32 UTC (permalink / raw)
To: Drew Adams; +Cc: Emacs-Devel
> Resending, at Richard's request.
Could you digest it into a single thread of text. The current mess of
forward and backward quoting is just unreadable.
Stefan
>> -----Original Message-----
>> From: Richard Stallman Sent: Wednesday, July 18, 2007 1:54 PM
>> To: Drew Adams
>>
>> Not really; haven't thought much about it. As I said,
>> I've been using
>> `C-M-SPC' for `mark-thing' (stealing from `mark-sexp')
>> and `M-@' for
>> `cycle-thing-region' (stealing from `mark-word').
>>
>> Those might be a good replacement, because I would expect people don't
>> use those two bindings very much. But we have to ask people first.
>> -----Original Message-----
>> From: Drew Adams Sent: Tuesday, July 17, 2007 9:52 PM
>> To: rms@gnu.org
>>
>> > > If the region is not yet active, then you are prompted (with
>> > > completion) for the type of thing to select. The default type
>> > > is `sexp'.
>> >
>> > For the first such thing, the region is not active, so you
>> > are prompted. For subsequent (successive) things, there is
>> > no prompt - the same type is used as the last. When you are
>> > prompted, `sexp' is the default type.
>> >
>> > I see. Maybe it is a good idea. If people like it, we can
>> install it
>> > in Emacs.
>> >
>> > Do you have suggested bindings for these two commands?
>>
>> Not really; haven't thought much about it. As I said, I've
>> been using `C-M-SPC' for `mark-thing' (stealing from
>> `mark-sexp') and `M-@' for `cycle-thing-region' (stealing
>> from `mark-word'). But, as I also said, I'm not suggesting
>> changing those bindings for Emacs.
>>
>> I think these commands are mainly useful for Transient Mark
>> mode, if that helps. Perhaps there are some bindings that
>> normally make less sense in t-m mode, which could therefore
>> be recuperated. I don't know.
>> -----Original Message-----
>> From: Drew Adams Sent: Monday, July 16, 2007 12:17 AM
>> To: Emacs-Devel
>>
>> Any interest in these commands? They let you select (that is,
>> mark) various
>> things at or near point. They are most useful in Transient
>> Mark mode - they
>> act differently depending on whether the mark is active.
>>
>> * `mark-thing' selects successive things, starting at point.
>> The mark is put
>> at the same place that command 'forward-'thing would put it
>> (using the same
>> prefix argument). If the region is not yet active, then you
>> are prompted
>> (with completion) for the type of thing to select. The default type is
>> `sexp'.
>>
>> * `cycle-thing-region' selects one thing at or near point
>> (just the thing,
>> not from point through the thing, even if the thing is not exactly at
>> point). Repeat it to cycle among the thing types - one thing
>> of the current
>> type is selected at each invocation. The default order of
>> types is `word',
>> `sexp', `list', `line', `sentence', `paragraph', `page',
>> `defun', `number',
>> `form'. That order is customizable, and a major mode could
>> also change it to
>> put the most commonly used types first.
>>
>> I bind `mark-thing' to `C-M-SPC' as a replacement for `mark-sexp'.
>>
>> I bind `cycle-thing-region' to `M-@' as a replacement for
>> `mark-word'. (By
>> default, it does what `mark-word' does without a prefix arg. Unlike,
>> `mark-thing', however, `cycle-thing-region' does not accept a
>> prefix arg.)
>>
>> I don't propose these bindings for Emacs generally, but if you use
>> transient-mark mode you might want to give them a try.
>>
>> To select successive things in transient-mark mode, you can use
>> `cycle-thing-region' as an alternative to completion for
>> choosing the thing
>> type for `mark-thing' - but you need to use `C-x C-x' between
>> the two. That
>> is, you can use 'M-@ C-x C-x C-M-SPC' to select successive
>> words, 'M-@ M-@
>> C-x C-x C-M-SPC' for successive symbols, and so on.
>>
>> The code is attached.
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: FW: commands to select things of different kinds
2008-03-10 3:32 ` Stefan Monnier
@ 2008-03-10 4:30 ` Drew Adams
0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2008-03-10 4:30 UTC (permalink / raw)
To: 'Stefan Monnier'; +Cc: 'Emacs-Devel'
[-- Attachment #1: Type: text/plain, Size: 2252 bytes --]
> Could you digest it into a single thread of text. The current mess of
> forward and backward quoting is just unreadable.
Everything important is in the original post. I've repeated it below.
RMS asked how it knows what kind of thing to select, to which I repeated
that if the region is not yet active you are prompted with completion for
the type of thing to select (default: sexp).
--- original post ---
From: Drew Adams Sent: Monday, July 16, 2007 12:17 AM
Any interest in these commands? They let you select (that is, mark) various
things at or near point. They are most useful in Transient Mark mode - they
act differently depending on whether the mark is active.
* `mark-thing' selects successive things, starting at point. The mark is put
at the same place that command 'forward-'thing would put it (using the same
prefix argument). If the region is not yet active, then you are prompted
(with completion) for the type of thing to select. The default type is
`sexp'.
* `cycle-thing-region' selects one thing at or near point (just the thing,
not from point through the thing, even if the thing is not exactly at
point). Repeat it to cycle among the thing types - one thing of the current
type is selected at each invocation. The default order of types is `word',
`sexp', `list', `line', `sentence', `paragraph', `page', `defun', `number',
`form'. That order is customizable, and a major mode could also change it to
put the most commonly used types first.
I bind `mark-thing' to `C-M-SPC' as a replacement for `mark-sexp'.
I bind `cycle-thing-region' to `M-@' as a replacement for `mark-word'. (By
default, it does what `mark-word' does without a prefix arg. Unlike,
`mark-thing', however, `cycle-thing-region' does not accept a prefix arg.)
I don't propose these bindings for Emacs generally, but if you use
transient-mark mode you might want to give them a try.
To select successive things in transient-mark mode, you can use
`cycle-thing-region' as an alternative to completion for choosing the thing
type for `mark-thing' - but you need to use `C-x C-x' between the two. That
is, you can use 'M-@ C-x C-x C-M-SPC' to select successive words, 'M-@ M-@
C-x C-x C-M-SPC' for successive symbols, and so on.
The code is attached.
[-- Attachment #2: thing-cmds.el --]
[-- Type: application/octet-stream, Size: 8042 bytes --]
;;; thing-cmds.el --- Commands that use things, as defined by `thingatpt.el'.
;;
;; Filename: thing-cmds.el
;; Description: Commands that use things, as defined by `thingatpt.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 2006-2007, Drew Adams, all rights reserved.
;; Created: Sun Jul 30 16:40:29 2006
;; Version: 20.1
;; Last-Updated: Sun Jul 15 23:58:11 2007 (-25200 Pacific Daylight Time)
;; By: dradams
;; Update #: 41
;; URL: http://www.emacswiki.org/cgi-bin/wiki/thing-cmds.el
;; Keywords: thingatpt, thing, region, selection
;; Compatibility: GNU Emacs 20.x, GNU Emacs 21.x, GNU Emacs 22.x
;;
;; Features that might be required by this library:
;;
;; `thingatpt', `thingatpt+'.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; You can use the commands defined here to select different kinds of
;; text entities ("things"). They are especially useful in
;; combination with Transient Mark mode.
;;
;; Commands defined here:
;;
;; `cycle-thing-region', `mark-thing', `select-thing-near-point',
;; `thing-region'.
;;
;; User options defined here:
;;
;; `thing-types'.
;;
;; Internal variables defined here:
;;
;; `mark-thing-type', `thing-region-index'.
;;
;; Put this in your init file (`~/.emacs'): (require 'thing-cmds)
;;
;; Suggested key bindings (these will replace the standard bindings
;; for `mark-sexp' and `mark-word'):
;;
;; (global-set-key [(control meta ? )] 'mark-thing) ; vs `mark-sexp'
;; (global-set-key [(meta ?@)] 'cycle-thing-region) ; vs `mark-word'
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change log:
;;
;; 2007/07/15 dadams
;; Added cycle-thing-region-point.
;; cycle-thing-region: Save point in cycle-thing-region-point and reuse it.
;; 2006/07/30 dadams
;; Created.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program 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 program 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 this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(require 'thingatpt+ nil t) ;; (no error if not found): bounds-of-thing-at-point
(require 'thingatpt) ;; bounds-of-thing-at-point
(when (< emacs-major-version 20) (eval-when-compile (require 'cl))) ;; when, unless
;;;;;;;;;;;;;;;;;;;;;;;;
(defun thing-region (thing)
"Set the region around a THING near the cursor.
You are prompted for the type of thing. Completion is available for
some standard types of thing, but you can enter any type.
The cursor is placed at the end of the region. You can return it to
the original location by using `C-u C-SPC' twice."
(interactive (list (let ((icicle-sort-function nil))
(completing-read "Type of thing: " (mapcar #'list thing-types)
nil nil nil nil "sexp"))))
(let* ((bds (if (fboundp 'bounds-of-thing-nearest-point) ; In `thingatpt+.el'.
(bounds-of-thing-nearest-point (intern thing))
(bounds-of-thing-at-point (intern thing))))
(start (car bds))
(end (cdr bds)))
(cond ((and start end)
(push-mark (point) t) ; Mark position, so can use `C-u C-SPC'.
(goto-char end)
(push-mark start t 'activate)
(setq deactivate-mark nil)
thing) ; Return thing.
(t
(message "No `%s' near point" thing)
(setq deactivate-mark nil)
nil)))) ; Return nil: no thing found.
(defalias 'select-thing-near-point 'cycle-thing-region)
(defun cycle-thing-region ()
"Select a thing near point. Successive uses select different things.
In Transient Mark mode, you can follow this with `\\[mark-thing]' to select
successive things of the same type, but to do that you must first use
`C-x C-x': `\\[cycle-thing-region] C-x C-x \\[mark-thing]'"
(interactive)
(if (eq last-command this-command)
(goto-char cycle-thing-region-point)
(setq thing-region-index 0)
(setq cycle-thing-region-point (point)))
(let* ((thing (elt thing-types thing-region-index))
(success (thing-region thing)))
(setq thing-region-index (1+ thing-region-index))
(when success
(setq mark-thing-type (intern thing)) ; Save it for `mark-thing'.
(message "%s" (capitalize (elt thing-types (1- thing-region-index)))))
(when (>= thing-region-index (length thing-types)) (setq thing-region-index 0))))
(defcustom thing-types '("word" "symbol" "sexp" "list" "line" "sentence"
"paragraph" "page" "defun" "number" "form")
"List of thing types. Used for completion and `cycle-thing-region'.
Each element is a string that names a type of text entity for which
there is a either a corresponding `forward-'thing operation, or
corresponding `beginning-of-'thing and `end-of-'thing operations.
Examples include \"word\", \"sentence\", and \"defun\"."
:type '(repeat string))
(defvar thing-region-index 0 "Index of current thing in `thing-types'.")
(defvar mark-thing-type nil "Current thing type used by `mark-thing'.")
(defvar cycle-thing-region-point nil
"Position of point before `cycle-thing-region'.")
(defun mark-thing (thing &optional arg allow-extend)
"Set the mark ARG THINGs from point.
THING is a string that names a type of thing: \"word\", \"sexp\", and
so on. See option `thing-types' for more examples.
The mark is put at the same place command `forward-'THING would put it
with the same prefix argument.
If the prefix argument (ARG) is negative, then point is put at the end
of the THING, amd mark is put at the beginning of the THING or a
previous THING.
Interactively:
You are prompted for THING. Completion is available for the types of
thing in `thing-types', but you can enter any type.
If `mark-thing' is repeated or if the mark is active (in Transient
Mark mode), then it marks the next ARG THINGs, after the ones already
marked."
(interactive "i\nP\np") ; THING arg is nil (ignored) interactively.
(cond ((and allow-extend (or (and (eq last-command this-command) (mark t))
(and transient-mark-mode mark-active)))
(setq arg (if arg
(prefix-numeric-value arg)
(if (< (mark) (point)) -1 1)))
(set-mark (save-excursion
(goto-char (mark))
(forward-thing mark-thing-type arg)
(point))))
(t
(setq mark-thing-type
(or thing (intern (let ((icicle-sort-function nil))
(completing-read "Type of thing: "
(mapcar #'list thing-types)
nil nil nil nil "sexp")))))
(push-mark (save-excursion
(forward-thing mark-thing-type (prefix-numeric-value arg))
(point))
nil t)))
(setq deactivate-mark nil))
;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'thing-cmds)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; thing-cmds.el ends here
^ permalink raw reply [flat|nested] 14+ messages in thread
* FW: commands to select things of different kinds
@ 2008-04-18 22:06 Drew Adams
2008-04-19 3:42 ` Stefan Monnier
0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2008-04-18 22:06 UTC (permalink / raw)
To: Emacs-Devel
[-- Attachment #1: Type: text/plain, Size: 3736 bytes --]
Resending -
----
Sent: Sunday, March 09, 2008 9:45 AM
Resending, at Richard's request.
> From: Richard Stallman Sent: Wednesday, July 18, 2007 1:54 PM
> To: Drew Adams
>
> Not really; haven't thought much about it. As I said,
> I've been using
> `C-M-SPC' for `mark-thing' (stealing from `mark-sexp')
> and `M-@' for
> `cycle-thing-region' (stealing from `mark-word').
>
> Those might be a good replacement, because I would expect people don't
> use those two bindings very much. But we have to ask people first.
> -----Original Message-----
> From: Drew Adams Sent: Tuesday, July 17, 2007 9:52 PM
> To: rms@gnu.org
>
> > > If the region is not yet active, then you are prompted (with
> > > completion) for the type of thing to select. The default type
> > > is `sexp'.
> >
> > For the first such thing, the region is not active, so you
> > are prompted. For subsequent (successive) things, there is
> > no prompt - the same type is used as the last. When you are
> > prompted, `sexp' is the default type.
> >
> > I see. Maybe it is a good idea. If people like it, we can
> install it
> > in Emacs.
> >
> > Do you have suggested bindings for these two commands?
>
> Not really; haven't thought much about it. As I said, I've
> been using `C-M-SPC' for `mark-thing' (stealing from
> `mark-sexp') and `M-@' for `cycle-thing-region' (stealing
> from `mark-word'). But, as I also said, I'm not suggesting
> changing those bindings for Emacs.
>
> I think these commands are mainly useful for Transient Mark
> mode, if that helps. Perhaps there are some bindings that
> normally make less sense in t-m mode, which could therefore
> be recuperated. I don't know.
> -----Original Message-----
> From: Drew Adams Sent: Monday, July 16, 2007 12:17 AM
> To: Emacs-Devel
>
> Any interest in these commands? They let you select (that is,
> mark) various
> things at or near point. They are most useful in Transient
> Mark mode - they
> act differently depending on whether the mark is active.
>
> * `mark-thing' selects successive things, starting at point.
> The mark is put
> at the same place that command 'forward-'thing would put it
> (using the same
> prefix argument). If the region is not yet active, then you
> are prompted
> (with completion) for the type of thing to select. The default type is
> `sexp'.
>
> * `cycle-thing-region' selects one thing at or near point
> (just the thing,
> not from point through the thing, even if the thing is not exactly at
> point). Repeat it to cycle among the thing types - one thing
> of the current
> type is selected at each invocation. The default order of
> types is `word',
> `sexp', `list', `line', `sentence', `paragraph', `page',
> `defun', `number',
> `form'. That order is customizable, and a major mode could
> also change it to
> put the most commonly used types first.
>
> I bind `mark-thing' to `C-M-SPC' as a replacement for `mark-sexp'.
>
> I bind `cycle-thing-region' to `M-@' as a replacement for
> `mark-word'. (By
> default, it does what `mark-word' does without a prefix arg. Unlike,
> `mark-thing', however, `cycle-thing-region' does not accept a
> prefix arg.)
>
> I don't propose these bindings for Emacs generally, but if you use
> transient-mark mode you might want to give them a try.
>
> To select successive things in transient-mark mode, you can use
> `cycle-thing-region' as an alternative to completion for
> choosing the thing
> type for `mark-thing' - but you need to use `C-x C-x' between
> the two. That
> is, you can use 'M-@ C-x C-x C-M-SPC' to select successive
> words, 'M-@ M-@
> C-x C-x C-M-SPC' for successive symbols, and so on.
>
> The code is attached.
[-- Attachment #2: thing-cmds.el --]
[-- Type: application/octet-stream, Size: 8042 bytes --]
;;; thing-cmds.el --- Commands that use things, as defined by `thingatpt.el'.
;;
;; Filename: thing-cmds.el
;; Description: Commands that use things, as defined by `thingatpt.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 2006-2007, Drew Adams, all rights reserved.
;; Created: Sun Jul 30 16:40:29 2006
;; Version: 20.1
;; Last-Updated: Sun Jul 15 23:58:11 2007 (-25200 Pacific Daylight Time)
;; By: dradams
;; Update #: 41
;; URL: http://www.emacswiki.org/cgi-bin/wiki/thing-cmds.el
;; Keywords: thingatpt, thing, region, selection
;; Compatibility: GNU Emacs 20.x, GNU Emacs 21.x, GNU Emacs 22.x
;;
;; Features that might be required by this library:
;;
;; `thingatpt', `thingatpt+'.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; You can use the commands defined here to select different kinds of
;; text entities ("things"). They are especially useful in
;; combination with Transient Mark mode.
;;
;; Commands defined here:
;;
;; `cycle-thing-region', `mark-thing', `select-thing-near-point',
;; `thing-region'.
;;
;; User options defined here:
;;
;; `thing-types'.
;;
;; Internal variables defined here:
;;
;; `mark-thing-type', `thing-region-index'.
;;
;; Put this in your init file (`~/.emacs'): (require 'thing-cmds)
;;
;; Suggested key bindings (these will replace the standard bindings
;; for `mark-sexp' and `mark-word'):
;;
;; (global-set-key [(control meta ? )] 'mark-thing) ; vs `mark-sexp'
;; (global-set-key [(meta ?@)] 'cycle-thing-region) ; vs `mark-word'
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change log:
;;
;; 2007/07/15 dadams
;; Added cycle-thing-region-point.
;; cycle-thing-region: Save point in cycle-thing-region-point and reuse it.
;; 2006/07/30 dadams
;; Created.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program 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 program 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 this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(require 'thingatpt+ nil t) ;; (no error if not found): bounds-of-thing-at-point
(require 'thingatpt) ;; bounds-of-thing-at-point
(when (< emacs-major-version 20) (eval-when-compile (require 'cl))) ;; when, unless
;;;;;;;;;;;;;;;;;;;;;;;;
(defun thing-region (thing)
"Set the region around a THING near the cursor.
You are prompted for the type of thing. Completion is available for
some standard types of thing, but you can enter any type.
The cursor is placed at the end of the region. You can return it to
the original location by using `C-u C-SPC' twice."
(interactive (list (let ((icicle-sort-function nil))
(completing-read "Type of thing: " (mapcar #'list thing-types)
nil nil nil nil "sexp"))))
(let* ((bds (if (fboundp 'bounds-of-thing-nearest-point) ; In `thingatpt+.el'.
(bounds-of-thing-nearest-point (intern thing))
(bounds-of-thing-at-point (intern thing))))
(start (car bds))
(end (cdr bds)))
(cond ((and start end)
(push-mark (point) t) ; Mark position, so can use `C-u C-SPC'.
(goto-char end)
(push-mark start t 'activate)
(setq deactivate-mark nil)
thing) ; Return thing.
(t
(message "No `%s' near point" thing)
(setq deactivate-mark nil)
nil)))) ; Return nil: no thing found.
(defalias 'select-thing-near-point 'cycle-thing-region)
(defun cycle-thing-region ()
"Select a thing near point. Successive uses select different things.
In Transient Mark mode, you can follow this with `\\[mark-thing]' to select
successive things of the same type, but to do that you must first use
`C-x C-x': `\\[cycle-thing-region] C-x C-x \\[mark-thing]'"
(interactive)
(if (eq last-command this-command)
(goto-char cycle-thing-region-point)
(setq thing-region-index 0)
(setq cycle-thing-region-point (point)))
(let* ((thing (elt thing-types thing-region-index))
(success (thing-region thing)))
(setq thing-region-index (1+ thing-region-index))
(when success
(setq mark-thing-type (intern thing)) ; Save it for `mark-thing'.
(message "%s" (capitalize (elt thing-types (1- thing-region-index)))))
(when (>= thing-region-index (length thing-types)) (setq thing-region-index 0))))
(defcustom thing-types '("word" "symbol" "sexp" "list" "line" "sentence"
"paragraph" "page" "defun" "number" "form")
"List of thing types. Used for completion and `cycle-thing-region'.
Each element is a string that names a type of text entity for which
there is a either a corresponding `forward-'thing operation, or
corresponding `beginning-of-'thing and `end-of-'thing operations.
Examples include \"word\", \"sentence\", and \"defun\"."
:type '(repeat string))
(defvar thing-region-index 0 "Index of current thing in `thing-types'.")
(defvar mark-thing-type nil "Current thing type used by `mark-thing'.")
(defvar cycle-thing-region-point nil
"Position of point before `cycle-thing-region'.")
(defun mark-thing (thing &optional arg allow-extend)
"Set the mark ARG THINGs from point.
THING is a string that names a type of thing: \"word\", \"sexp\", and
so on. See option `thing-types' for more examples.
The mark is put at the same place command `forward-'THING would put it
with the same prefix argument.
If the prefix argument (ARG) is negative, then point is put at the end
of the THING, amd mark is put at the beginning of the THING or a
previous THING.
Interactively:
You are prompted for THING. Completion is available for the types of
thing in `thing-types', but you can enter any type.
If `mark-thing' is repeated or if the mark is active (in Transient
Mark mode), then it marks the next ARG THINGs, after the ones already
marked."
(interactive "i\nP\np") ; THING arg is nil (ignored) interactively.
(cond ((and allow-extend (or (and (eq last-command this-command) (mark t))
(and transient-mark-mode mark-active)))
(setq arg (if arg
(prefix-numeric-value arg)
(if (< (mark) (point)) -1 1)))
(set-mark (save-excursion
(goto-char (mark))
(forward-thing mark-thing-type arg)
(point))))
(t
(setq mark-thing-type
(or thing (intern (let ((icicle-sort-function nil))
(completing-read "Type of thing: "
(mapcar #'list thing-types)
nil nil nil nil "sexp")))))
(push-mark (save-excursion
(forward-thing mark-thing-type (prefix-numeric-value arg))
(point))
nil t)))
(setq deactivate-mark nil))
;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'thing-cmds)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; thing-cmds.el ends here
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: FW: commands to select things of different kinds
2008-04-18 22:06 Drew Adams
@ 2008-04-19 3:42 ` Stefan Monnier
2008-04-19 20:11 ` Juri Linkov
0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2008-04-19 3:42 UTC (permalink / raw)
To: Drew Adams; +Cc: Emacs-Devel
>> Not really; haven't thought much about it. As I said,
>> I've been using
>> `C-M-SPC' for `mark-thing' (stealing from `mark-sexp')
>> and `M-@' for
>> `cycle-thing-region' (stealing from `mark-word').
>>
>> Those might be a good replacement, because I would expect people don't
>> use those two bindings very much. But we have to ask people first.
I use C-M-SPC *very* often, typically just before C-y (together with
a variant of delete-selection-mode).
That doesn't mean it can't be changed, but its current functionality
should still be at least somewhat preserved.
Stefan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: FW: commands to select things of different kinds
2008-04-19 3:42 ` Stefan Monnier
@ 2008-04-19 20:11 ` Juri Linkov
2008-04-19 20:22 ` David Kastrup
2008-04-19 20:35 ` Drew Adams
0 siblings, 2 replies; 14+ messages in thread
From: Juri Linkov @ 2008-04-19 20:11 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Drew Adams, Emacs-Devel
> I use C-M-SPC *very* often, typically just before C-y (together with
> a variant of delete-selection-mode).
BTW, since now shift-selection is available by default, I think we should
enable delete-selection-mode, because otherwise it is very confusing
for users coming from other programs to discover the weird behavior
of transient-mark-mode when delete-selection-mode is disabled.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: FW: commands to select things of different kinds
2008-04-19 20:11 ` Juri Linkov
@ 2008-04-19 20:22 ` David Kastrup
2008-04-19 23:18 ` Richard Stallman
2008-04-19 20:35 ` Drew Adams
1 sibling, 1 reply; 14+ messages in thread
From: David Kastrup @ 2008-04-19 20:22 UTC (permalink / raw)
To: Juri Linkov; +Cc: Stefan Monnier, Drew Adams, Emacs-Devel
Juri Linkov <juri@jurta.org> writes:
>> I use C-M-SPC *very* often, typically just before C-y (together with
>> a variant of delete-selection-mode).
>
> BTW, since now shift-selection is available by default, I think we should
> enable delete-selection-mode, because otherwise it is very confusing
> for users coming from other programs to discover the weird behavior
> of transient-mark-mode when delete-selection-mode is disabled.
No. I am already getting surprise region activations with the current
settings. Getting it erased by surprise is not what I consider fun.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: FW: commands to select things of different kinds
2008-04-19 20:11 ` Juri Linkov
2008-04-19 20:22 ` David Kastrup
@ 2008-04-19 20:35 ` Drew Adams
2008-04-19 22:54 ` Juri Linkov
1 sibling, 1 reply; 14+ messages in thread
From: Drew Adams @ 2008-04-19 20:35 UTC (permalink / raw)
To: 'Juri Linkov', 'Stefan Monnier'; +Cc: 'Emacs-Devel'
> > I use C-M-SPC *very* often, typically just before C-y (together with
> > a variant of delete-selection-mode).
>
> BTW, since now shift-selection is available by default, I
> think we should
> enable delete-selection-mode, because otherwise it is very confusing
> for users coming from other programs to discover the weird behavior
> of transient-mark-mode when delete-selection-mode is disabled.
Here we go again...
Can you please start a different thread for that?
This thread is _not at all_ about whether delete-selection-mode or t-m-mode
should be enabled by default.
This thread is about some proposed commands that let you mark various things at
or near point.
And which keys might be bound to those commands is a secondary consideration,
relevant only if the commands are accepted. There is nothing in the proposal
about using C-M-SPC or any other keys, in particular. It's about the commands.
If the commands are accepted, then we can argue endlessly about which keys, if
any, to bind to them.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: FW: commands to select things of different kinds
2008-04-19 20:35 ` Drew Adams
@ 2008-04-19 22:54 ` Juri Linkov
2008-04-19 23:22 ` Drew Adams
0 siblings, 1 reply; 14+ messages in thread
From: Juri Linkov @ 2008-04-19 22:54 UTC (permalink / raw)
To: Drew Adams; +Cc: 'Stefan Monnier', emacs-devel
> This thread is about some proposed commands that let you mark various
> things at or near point.
>
> And which keys might be bound to those commands is a secondary consideration,
> relevant only if the commands are accepted. There is nothing in the proposal
> about using C-M-SPC or any other keys, in particular. It's about the commands.
> If the commands are accepted, then we can argue endlessly about which keys, if
> any, to bind to them.
Generally I like your proposed commands to select things, but I think
C-M-SPC is an inappropriate key binding. Sorry, I can't propose another key
to bind these commands now.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: FW: commands to select things of different kinds
2008-04-19 20:22 ` David Kastrup
@ 2008-04-19 23:18 ` Richard Stallman
0 siblings, 0 replies; 14+ messages in thread
From: Richard Stallman @ 2008-04-19 23:18 UTC (permalink / raw)
To: David Kastrup; +Cc: juri, monnier, drew.adams, emacs-devel
I am very much against enabling delete-selection-mode by default.
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: FW: commands to select things of different kinds
2008-04-19 22:54 ` Juri Linkov
@ 2008-04-19 23:22 ` Drew Adams
2008-04-20 23:52 ` Juri Linkov
0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2008-04-19 23:22 UTC (permalink / raw)
To: 'Juri Linkov'; +Cc: 'Stefan Monnier', emacs-devel
> > This thread is about some proposed commands that let you
> > mark various things at or near point.
> >
> > And which keys might be bound to those commands is a
> > secondary consideration, relevant only if the commands
> > are accepted. There is nothing in the proposal about
> > using C-M-SPC or any other keys, in particular. It's
> > about the commands. If the commands are accepted, then
> > we can argue endlessly about which keys, if any, to
> > bind to them.
>
> Generally I like your proposed commands to select things, but I
> think C-M-SPC is an inappropriate key binding. Sorry, I can't
> propose another key to bind these commands now.
Let's not worry about the keys until people agree to adding the commands. If
they don't agree, then we can save the time and hassle of looking for
appropriate keys.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: FW: commands to select things of different kinds
2008-04-19 23:22 ` Drew Adams
@ 2008-04-20 23:52 ` Juri Linkov
2008-04-21 0:13 ` Drew Adams
2008-04-21 1:03 ` Stefan Monnier
0 siblings, 2 replies; 14+ messages in thread
From: Juri Linkov @ 2008-04-20 23:52 UTC (permalink / raw)
To: Drew Adams; +Cc: 'Stefan Monnier', emacs-devel
>> > This thread is about some proposed commands that let you
>> > mark various things at or near point.
>> >
>> > And which keys might be bound to those commands is a
>> > secondary consideration, relevant only if the commands
>> > are accepted. There is nothing in the proposal about
>> > using C-M-SPC or any other keys, in particular. It's
>> > about the commands. If the commands are accepted, then
>> > we can argue endlessly about which keys, if any, to
>> > bind to them.
>>
>> Generally I like your proposed commands to select things, but I
>> think C-M-SPC is an inappropriate key binding. Sorry, I can't
>> propose another key to bind these commands now.
>
> Let's not worry about the keys until people agree to adding the commands. If
> they don't agree, then we can save the time and hassle of looking for
> appropriate keys.
I think the proper place to add these new commands is thingatpt.el.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: FW: commands to select things of different kinds
2008-04-20 23:52 ` Juri Linkov
@ 2008-04-21 0:13 ` Drew Adams
2008-04-21 1:03 ` Stefan Monnier
1 sibling, 0 replies; 14+ messages in thread
From: Drew Adams @ 2008-04-21 0:13 UTC (permalink / raw)
To: 'Juri Linkov'; +Cc: 'Stefan Monnier', emacs-devel
> >> Generally I like your proposed commands to select things, but I
> >> think C-M-SPC is an inappropriate key binding. Sorry, I can't
> >> propose another key to bind these commands now.
> >
> > Let's not worry about the keys until people agree to adding
> > the commands. If they don't agree, then we can save the time
> > and hassle of looking for appropriate keys.
>
> I think the proper place to add these new commands is thingatpt.el.
Would you please do that then, or do we need more consensus/approval?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: FW: commands to select things of different kinds
2008-04-20 23:52 ` Juri Linkov
2008-04-21 0:13 ` Drew Adams
@ 2008-04-21 1:03 ` Stefan Monnier
1 sibling, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2008-04-21 1:03 UTC (permalink / raw)
To: Juri Linkov; +Cc: Drew Adams, emacs-devel
>> Let's not worry about the keys until people agree to adding the commands. If
>> they don't agree, then we can save the time and hassle of looking for
>> appropriate keys.
> I think the proper place to add these new commands is thingatpt.el.
Sounds right.
Stefan
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-04-21 1:03 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-09 16:45 FW: commands to select things of different kinds Drew Adams
2008-03-10 3:32 ` Stefan Monnier
2008-03-10 4:30 ` Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2008-04-18 22:06 Drew Adams
2008-04-19 3:42 ` Stefan Monnier
2008-04-19 20:11 ` Juri Linkov
2008-04-19 20:22 ` David Kastrup
2008-04-19 23:18 ` Richard Stallman
2008-04-19 20:35 ` Drew Adams
2008-04-19 22:54 ` Juri Linkov
2008-04-19 23:22 ` Drew Adams
2008-04-20 23:52 ` Juri Linkov
2008-04-21 0:13 ` Drew Adams
2008-04-21 1:03 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.