* Emacs standards with regions
@ 2008-11-24 15:03 Richard Riley
2008-11-24 16:46 ` Xah Lee
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Richard Riley @ 2008-11-24 15:03 UTC (permalink / raw)
To: help-gnu-emacs
Is there some reason that most emacs commands do not consider active
region when invoked? One of the biggest UI improvements (for me) would
be for interactive commands to default to the marked region.
e.g C-s for isearch-forward
Hilite "word" and "word" is the default search term. Ditto for % (search
and replace). I just modified my py-execute-buffer for example to call
py-execute-region with the marked region rather than the entire buffer
if the region was active. Why have a seperate "execute-region" command?
The ignoring of the region in so many key commands makes we wonder if I
am missnig a default setting or if there was a decision not to use the
region.
e.g this Google search function I use defaults
,----
| (defun rgr/google-search-prompt()
| (interactive)
| (let* ((default (region-or-word-at-point))
| (term (read-string (format "Google the web for the following phrase (%s): "
| default))))
| (message "term is %s. Length is %d" term (length term))
| (rgr/google (if (zerop(length term)) default term))
| ))
`----
Can anyone add to this?
--
important and urgent problems of the technology of today are no longer the satisfactions of the primary needs or of archetypal wishes, but the reparation of the evils and damages by the technology of yesterday. ~Dennis Gabor, Innovations: Scientific, Technological and Social, 1970
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-24 15:03 Emacs standards with regions Richard Riley
@ 2008-11-24 16:46 ` Xah Lee
2008-11-24 18:15 ` Xah Lee
2008-11-26 8:19 ` Andreas Röhler
[not found] ` <mailman.1274.1227687564.26697.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 15+ messages in thread
From: Xah Lee @ 2008-11-24 16:46 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 24, 7:03 am, Richard Riley <rileyrg...@gmail.com> wrote:
> One of the biggest UI improvements (for me) would
> be for interactive commands to default to the marked region.
i feel exactly the same way. If emacs commands use active region as a
way for alternative behavior (similiar to many commands using Ctrl+u
to change behavior), i think that's a improvement.
almost all my own commands, will consider active region if there is
one, and act on that. There are about 30 of them. My examples
includes:
• lookup-google, lookup-php-ref, lookup-wikipedia, lookup-word-def,
lookup-word-definition
• amazon-linkify, blog-url-linkify, curve-linkify, elisp-ref-linkify,
emacs-ref-linkify, full-size-img-linkify, google-search-linkify, image-
linkify, java-ref-linkify, local-linkify, mathematica-ref-linkify, nks-
linkify, perldoc-ref-linkify, php-ref-linkify, povray-ref-linkify,
python-ref-linkify, source-linkify, wikipedia-linkify, youporn-search-
linkify, youtube-linkify, youtube-search-linkify
• make-backup, make-html-table, make-word-entry, make-wiki-entry, make-
time-mag-src
a very good example of this is a command that deal with letter cases.
Recently i wrote about it here:
• Usability Problems With Emacs's Letter-Case Commands
http://xahlee.org/emacs/modernization_upcase-word.html
---------------------------------
«Is there some reason that most emacs commands do not consider active
region when invoked?»
I think the reason is that, transient-mark-mode, and thus the concept
of active-region (i.e. known as Text Selection in modern terminology),
is a later add on. I'm guessing it is added in late 1990s or perhaps
after 2000. It is a add-on as some kinda compatibility with modern UI,
and probably is not considered as the emacs's way by most emacs
developers.
does anyone know when did transient-mark-mode come to emacs?
Even today, Richard Stallman is still rather anti transient-mark-mode.
(if you read emacs dev, he doesn't use it) For example, recently i
filed a bug report about delete-selection-mode, here:
Subject: bug#1120: issues on (put 'insert-date 'delete-selection t)
http://groups.google.com/group/gnu.emacs.bug/browse_frm/thread/ba8ab4a5223591b7
In the discussion, i wrote:
«
For elisp programers who wish to write extentions where the command's
behaviors change depending on whether user has delete-selection-mode
on, what should they do? Check for mark-active and delete-selection-
mode before any call to the insert function?
also, the current behavior seems to introduce a complexity, where
command behaves differently depending on whether it is invoked by a
keybinding or by M-x.
»
and Richard Stallman wrote:
«If you really want to make behavior depend on those variables, you
need to check them. Whether you check them before or after calling
`insert' is up to you. But that seems like a strange thing to do.»
The thread where this is discussed is here:
Subject: (insert ...) won't respect delete-selection-mode
Date: 2008-10-07
http://groups.google.com/group/gnu.emacs.help/browse_frm/thread/8cc49311d17b2a71
-----------------
I have put a lot thought in this issue, which of the 2 behaviors on
the region is superior in some technical sense (while disregard all
issues about “Modern UI” or “Standard practice”). Supeior here means
aspects of user operative efficiency, and power/flexibilty of commands
using one or the other paradigm.
To be precise, here's 2 behavior considered:
(1) The emacs traditional way. Namely, there is always a region, and
commands that might be useful to work on region, will have few choices
of interface: (A) have multiple versions of the command, one ending in
“-region”. (B) using universal argument mechanism (Ctrl+u) to specify
whether the command acts on region.
(note: a region in emacs is from last mark to current cursor position,
and there is always a region as soon as user did a mark once in a
buffer)
(2) The modern UI practice, meaning, a region in emacs can be active
or inactive. For commands that might be useful to consider applying to
the region, it has these choices: (A) same as above. (B) same as
above. (C) Act on region if there is a active region (aka text
selection).
Now, notice, that majority of emacs's commands use paradigm (1).
However, some of emacs's commands, do use paradim (2) and (C). For
example, comment-dwim is a good example.
I haven't studied this extensively, but basically, i think (C)
behavior is the superior one, that is: it is faster to invoke (less
keystrokes, regardless what easy key shortcuts you may have setup),
more intuitive to vast majority of computer users today, involves less
thinking.
Also note, for paradigm (2), it means that you must have transient-
mark-mode or cua-mode on. In other words, if you never use or want
region highlighting, you'll not find any possibly extra benefit of
commands that uses paradigm (2).
As noted before, transient-mark-mode and cua-mode are not on by
default, and they both are added to emacs as some compatibility mode,
and it is reasonable to assume that most emacs developers don't
consider them genuine “emacs way”, thus i think that's the reason
paradigm (2) is not much used in emacs even for newer packages.
i heard that in the current dev version of emacs, cua-mode is on by
default. I think that might usher more emacs commands to use paradigm
(2)...
-----------------------------
Note that the main purpose of transient-mark-mode is to have region
highlight, and in emacs, this cannot be possible without introducing
the concept of active region. But now, with the concept of active
region, it necessarily divide command UI paradigm into 2 groups, one
that is the emacs's traditional way of always having a region, as the
above paradigm (1), vs one that consider region as active/inactive as
above (2).
In short, in order to maintain emacs's traditional concept of region,
and in order to have region highlighting, spawned the 2 UI paradigms
that are not necessarily consistant with each other. If you want the
feature of region highlighting yet not obsolete the traditional
concept of emacs region and with it htousands of existing commands,
then these 2 not-necessarily consistent UI paradigms are inevitable.
In a ideal world, i would say it'd be better to exam and change the
few thousand of emac's commands so that they all consider active
region, and as a consequence possibly reducing tens of them. But this
is not realistic. On the other hand, i do not think it would introduce
any practical UI inconsistency if more commands starts to consider
active region.
-----------------------------
one thing i personally want is to have isearch automatically use the
current text selection for search. (this is a frequently asked
question) I tried to write my own custome function to do this but it
turns out not easy ...
as long as transient-mark-mode is not on by default, much of the above
thoughts won't even be possible. With cua-mode on by default in the
next version of emacs, i think that's a giant step forward.
------------------------------
«important and urgent problems of the technology of today are no
longer the satisfactions of the primary needs or of archetypal wishes,
but the reparation of the evils and damages by the technology of
yesterday. ~Dennis Gabor, Innovations: Scientific, Technological and
Social, 1970»
Great words!
... looking up Wikipedia, here's the url:
http://en.wikipedia.org/wiki/Dennis_Gabor
... bah, spent too much time writing this post... Sorry for the
wordiness.
Xah
∑ http://xahlee.org/
☄
On Nov 24, 7:03 am, Richard Riley <rileyrg...@gmail.com> wrote:
> Is there some reason that most emacs commands do not consider active
> region when invoked? One of the biggest UI improvements (for me) would
> be for interactive commands to default to the marked region.
>
> e.g C-s for isearch-forward
>
> Hilite "word" and "word" is the default search term. Ditto for % (search
> and replace). I just modified my py-execute-buffer for example to call
> py-execute-region with the marked region rather than the entire buffer
> if the region was active. Why have a seperate "execute-region" command?
>
> The ignoring of the region in so many key commands makes we wonder if I
> am missnig a default setting or if there was a decision not to use the
> region.
>
> e.g this Google search function I use defaults
>
> ,----
> | (defun rgr/google-search-prompt()
> | (interactive)
> | (let* ((default (region-or-word-at-point))
> | (term (read-string (format "Google the web for the following phrase (%s): "
> | default))))
> | (message "term is %s. Length is %d" term (length term))
> | (rgr/google (if (zerop(length term)) default term))
> | ))
> `----
>
> Can anyone add to this?
>
> --
> important and urgent problems of the technology of today are no longer the satisfactions of the primary needs or of archetypal wishes, but the reparation of the evils and damages by the technology of yesterday. ~Dennis Gabor, Innovations: Scientific, Technological and Social, 1970
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-24 16:46 ` Xah Lee
@ 2008-11-24 18:15 ` Xah Lee
2008-11-24 21:07 ` Eli Zaretskii
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Xah Lee @ 2008-11-24 18:15 UTC (permalink / raw)
To: help-gnu-emacs
i looked up on when is transient-mark-mode added to emacs.
the earliest mention of transient-mark-mode in emacs's NEWS file is in
NEWS.19, and according to Wikipedia, emacs 19 is released in Sep 1997.
So, i suppose 1997 is the year emacs supports highlighting of region,
and the introduction of active region concept.
I also looked up cua...
The header file of cua mode has copyright dated back to 1997. The
first mention of cua mode is in NEWS.21 (released in 2001), quote:
«** The menu bar configuration has changed. The new configuration is
more CUA-compliant. The most significant change is that Options is
now a separate menu-bar item, with Mule and Customize as its
submenus. »
In emacs 22 news (released in 2007), it says:
«** CUA mode is now part of the Emacs distribution.»
So the standard copy/cut/paste and text selection user interface came
to emacs in 2007!!!
THAT'S LAST YEAR!! I did not even realize that this is this late!
gosh... how like to say that in general and in the current decade,
Open Source software are some 1 decade in playing catch up to
commercial software in aspects of user interface.
I don't think the picture would look better if one investigate on when
is mouse support, multiple graphical window support (emacs's “frame”),
scroll bar support, syntax highlighting came to emacs.
I have little doubte, that when each of these features were considered
in emacs, lots of diehard tech geekers think they are utterly stupid.
(in the early 1990s, Microsoft isn't yet hated, it was IBM, and before
that, AT&T (of Unix fame then), Symbolics (of lisp and hacker split
and birth of fSF fame), ...)
there are really a lot problems with the way tech geeker thinks...
for example, consider the naming of things. For example, when a emacs
user tried to read the online doc of comment-dwim, quote: “If the
region is active and `transient-mark-mode' is on, ...”. For more than
99% of professional programers, they'll go: “What the heck is
transient mark??”
and if you ask them what is “CUA”, they'd go “HUH????”
... a good solution here, is that in the emacs docs, the concept of
region active and transient-mark-mode on be equated with the phrase
Text Selection. So, for example, the sentence of the doc of comment-
dwim can go like this:
“If there is a text selection, ...”
if cua mode is on by default in emacs 23, then probably remove it from
menu under Options... emacs veterans know what to do if they want to
turn it off.
-------------------------------------
Here's linnes in emacs's news related to transient mark mode.
Emacs 22 News:
*** Marking commands extend the region when invoked multiple times.
*** Some commands do something special in Transient Mark mode when the
*** Diff mode key bindings changed ...In addition, C-c C-u now
operates on the region in Transient Mark mode when the mark is active.
*** If a command sets `transient-mark-mode' to `only', that
--------------------------
Emacs 21 news
*** The command `ispell' now spell-checks a region if transient-mark-
mode is on, and the mark is active
** The functions `keep-lines', `flush-lines' and `how-many' now
operate on the active region in Transient Mark mode.
------------------------
Emacs 20 news:
M-w when Transient Mark mode is enabled disables the mark.
In Transient Mark mode, undoing when a region is active requests
selective undo.
** In Transient Mark mode, when the region is active, M-x query-
replace and the other replace commands now operate on the region
contents only.
** In Transient Mark mode, the region in any one buffer is highlighted
in just one window at a time. At first, it is highlighted in the
window where you set the mark. The buffer's highlighting remains in
that window unless you select to another window which shows the same
buffer--then the highlighting moves to that window.
------------------
emacs 19 news:
** Marking with the mouse. When you mark a region with the mouse, the
region now remains highlighted until the next input event, regardless
of whether you are using M-x transient-mark-mode.
** Incremental search in Transient Mark mode, if the mark is already
** When dragging the mouse to select a region, Emacs now highlights
the region as you drag (if Transient Mark mode is enabled).
** If you enable Transient Mark mode and set `mark-even-if-inactive'
to non-nil, then the region is highlighted in a transient fashion just
as normally in Transient Mark mode, but the mark really remains active
all the time; commands that use the region can be used even if the
region highlighting turns off.
** The variable `highlight-nonselected-windows' now controls whether
the region is highlighted in windows other than the selected window
(in Transient Mark mode only, of course, and currently only when using
X).
** If you enable Transient Mark mode, then the mark becomes "inactive"
after every command that modifies the buffer. While the mark is
active, the region is highlighted (under X, at least). Most commands
that use the mark give an error if the mark is inactive, but you can
use C-x C-x to make it active again. This feature is also sometimes
known as "Zmacs mode".
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-24 18:15 ` Xah Lee
@ 2008-11-24 21:07 ` Eli Zaretskii
[not found] ` <mailman.1152.1227560873.26697.help-gnu-emacs@gnu.org>
` (2 subsequent siblings)
3 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2008-11-24 21:07 UTC (permalink / raw)
To: help-gnu-emacs
> From: Xah Lee <xahlee@gmail.com>
> Date: Mon, 24 Nov 2008 10:15:28 -0800 (PST)
>
> I have little doubte, that when each of these features were considered
> in emacs, lots of diehard tech geekers think they are utterly stupid.
Well, you should doubt it, because tech geekers had no problems at all
with including CUA mode in Emacs. The only reasons why it took so
long for CUA mode to become part of Emacs is that (1) there was a need
to find a way of doing that without losing important Emacs key
bindings like C-x and C-y, and (2) the satisfactory technical solution
was not ready in time for Emacs 22.1, and so was deferred to the next
major release.
> for example, consider the naming of things. For example, when a emacs
> user tried to read the online doc of comment-dwim, quote: “If the
> region is active and `transient-mark-mode' is on, ...”. For more than
> 99% of professional programers, they'll go: “What the heck is
> transient mark??”
>
> and if you ask them what is “CUA”, they'd go “HUH????”
No problems here, since those ``professional programmers'' simply
don't read documentation. So they will never be stumped by this
terminology. But if they would somehow, by sheer mistake, manage to
read that, there's a Glossary section which explains everything.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
[not found] ` <mailman.1152.1227560873.26697.help-gnu-emacs@gnu.org>
@ 2008-11-24 21:26 ` Richard Riley
0 siblings, 0 replies; 15+ messages in thread
From: Richard Riley @ 2008-11-24 21:26 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Xah Lee <xahlee@gmail.com>
>> Date: Mon, 24 Nov 2008 10:15:28 -0800 (PST)
>>
>> I have little doubte, that when each of these features were considered
>> in emacs, lots of diehard tech geekers think they are utterly stupid.
>
> Well, you should doubt it, because tech geekers had no problems at all
> with including CUA mode in Emacs. The only reasons why it took so
> long for CUA mode to become part of Emacs is that (1) there was a need
> to find a way of doing that without losing important Emacs key
> bindings like C-x and C-y, and (2) the satisfactory technical solution
> was not ready in time for Emacs 22.1, and so was deferred to the next
> major release.
>
>> for example, consider the naming of things. For example, when a emacs
>> user tried to read the online doc of comment-dwim, quote: “If the
>> region is active and `transient-mark-mode' is on, ...”. For more than
>> 99% of professional programers, they'll go: “What the heck is
>> transient mark??”
>>
>> and if you ask them what is “CUA”, they'd go “HUH????”
>
> No problems here, since those ``professional programmers'' simply
> don't read documentation. So they will never be stumped by this
> terminology. But if they would somehow, by sheer mistake, manage to
> read that, there's a Glossary section which explains everything.
Certainly it not being on by default was a bit weird for me. I believe
Emacs 23 it is default to be on.
Even the documentation appears to think the old behaviour was a bit
strange when transient mode mark was not on:
from
(emacs) Persistent Mark
,----
| Emacs does not show where the mark is located--you have to remember.
| The usual solution to this problem is to set the mark and then use
| it soon, before you forget where it is.
`----
I think I sense a bit of an agenda in that info snippet :-;
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-24 18:15 ` Xah Lee
2008-11-24 21:07 ` Eli Zaretskii
[not found] ` <mailman.1152.1227560873.26697.help-gnu-emacs@gnu.org>
@ 2008-11-25 3:40 ` Jason Rumney
2008-11-25 10:16 ` Xah Lee
2008-11-25 20:31 ` Teemu Likonen
3 siblings, 1 reply; 15+ messages in thread
From: Jason Rumney @ 2008-11-25 3:40 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 25, 2:15 am, Xah Lee <xah...@gmail.com> wrote:
> i looked up on when is transient-mark-mode added to emacs.
>
> the earliest mention of transient-mark-mode in emacs's NEWS file is in
> NEWS.19, and according to Wikipedia, emacs 19 is released in Sep 1997.
Wikipedia is wrong. Emacs 19.7 was released on 1993-05-22 according to
ChangeLog (19.6 appears in lisp/ChangeLog as an alpha release). lisp/
ChangeLog lists the following change:
1993-05-15 Richard Stallman (rms@mole.gnu.ai.mit.edu)
* simple.el (transient-mark-mode): New command.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-25 3:40 ` Jason Rumney
@ 2008-11-25 10:16 ` Xah Lee
2008-11-25 15:55 ` Jason Rumney
0 siblings, 1 reply; 15+ messages in thread
From: Xah Lee @ 2008-11-25 10:16 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 24, 7:40 pm, Jason Rumney <jasonrum...@gmail.com> wrote:
> On Nov 25, 2:15 am, Xah Lee <xah...@gmail.com> wrote:
>
> > i looked up on when is transient-mark-mode added to emacs.
>
> > the earliest mention of transient-mark-mode in emacs's NEWS file is in
> > NEWS.19, and according to Wikipedia, emacs 19 is released in Sep 1997.
>
> Wikipedia is wrong. Emacs 19.7 was released on 1993-05-22 according to
> ChangeLog (19.6 appears in lisp/ChangeLog as an alpha release). lisp/
> ChangeLog lists the following change:
>
> 1993-05-15 Richard Stallman (r...@mole.gnu.ai.mit.edu)
>
> * simple.el (transient-mark-mode): New command.
Thanks.
Btw, it's my citation of Wikipedia that's wrong. Wikipedia gave the
release date for 19.28, but i wasn't paying attention and simplified
it to 19.
Here's what Wikipedia says:
19.28 September 15, 1997
Support for multiple frames using the X Windowing System
New interface for version control systems, called VC
New hexl mode, which is a hexadecimal editing mode
-------------
btw, is there a public place to read all the release dates?
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-25 10:16 ` Xah Lee
@ 2008-11-25 15:55 ` Jason Rumney
2008-11-25 15:57 ` Richard Riley
0 siblings, 1 reply; 15+ messages in thread
From: Jason Rumney @ 2008-11-25 15:55 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 25, 6:16 pm, Xah Lee <xah...@gmail.com> wrote:
> Btw, it's my citation of Wikipedia that's wrong. Wikipedia gave the
> release date for 19.28, but i wasn't paying attention and simplified
> it to 19.
OK, so they're not wrong, just misleading. The changes they list for
19.28 were all made in earlier versions of 19.x (possibly all were
present in 19.7).
> btw, is there a public place to read all the release dates?
They're there for all to see in the ChangeLogs.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-25 15:55 ` Jason Rumney
@ 2008-11-25 15:57 ` Richard Riley
2008-11-25 18:01 ` Reiner Steib
0 siblings, 1 reply; 15+ messages in thread
From: Richard Riley @ 2008-11-25 15:57 UTC (permalink / raw)
To: help-gnu-emacs
Jason Rumney <jasonrumney@gmail.com> writes:
> On Nov 25, 6:16 pm, Xah Lee <xah...@gmail.com> wrote:
>
>> Btw, it's my citation of Wikipedia that's wrong. Wikipedia gave the
>> release date for 19.28, but i wasn't paying attention and simplified
>> it to 19.
>
> OK, so they're not wrong, just misleading. The changes they list for
> 19.28 were all made in earlier versions of 19.x (possibly all were
> present in 19.7).
>
>> btw, is there a public place to read all the release dates?
>
> They're there for all to see in the ChangeLogs.
Changelogs are a tad "programmer". I suspect Xah was asking if there was
a URL which listed an emacs timeline.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-25 15:57 ` Richard Riley
@ 2008-11-25 18:01 ` Reiner Steib
0 siblings, 0 replies; 15+ messages in thread
From: Reiner Steib @ 2008-11-25 18:01 UTC (permalink / raw)
To: help-gnu-emacs
On Tue, Nov 25 2008, Richard Riley wrote:
> I suspect Xah was asking if there was a URL which listed an emacs
> timeline.
<http://www.google.com/search?q=emacs+timeline>, first hit, gives you
Jamie Zawinski's Emacs timeline.
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-24 18:15 ` Xah Lee
` (2 preceding siblings ...)
2008-11-25 3:40 ` Jason Rumney
@ 2008-11-25 20:31 ` Teemu Likonen
2008-11-25 20:47 ` Xah Lee
3 siblings, 1 reply; 15+ messages in thread
From: Teemu Likonen @ 2008-11-25 20:31 UTC (permalink / raw)
To: help-gnu-emacs
Xah Lee (2008-11-24 10:15 -0800) wrote:
> if cua mode is on by default in emacs 23,
It's not.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-25 20:31 ` Teemu Likonen
@ 2008-11-25 20:47 ` Xah Lee
2008-11-25 23:55 ` Alan Mackenzie
0 siblings, 1 reply; 15+ messages in thread
From: Xah Lee @ 2008-11-25 20:47 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 25, 12:31 pm, Teemu Likonen <tliko...@iki.fi> wrote:
> Xah Lee (2008-11-24 10:15 -0800) wrote:
>
> > if cua mode is on by default in emacs 23,
>
> It's not.
my memory went faulty.
Alan Mackenzie said that the transient-mark-mode is now on by default.
Quote: “FWIW, Transient Mark Mode is going to be enabled by default in
Emacs 23.”, from http://groups.google.com/group/gnu.emacs.help/msg/dcba4f862fc8a7f5
the other majorish change i know of is that arrow up/down now moves by
visual line.
i do hope that cua'd be on ...
... maybe i should try to grab the emacs source... but then it's all
the pain of compilation and problems and spending hours tech
geeking ... EEEEE!
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-25 20:47 ` Xah Lee
@ 2008-11-25 23:55 ` Alan Mackenzie
0 siblings, 0 replies; 15+ messages in thread
From: Alan Mackenzie @ 2008-11-25 23:55 UTC (permalink / raw)
To: Xah Lee; +Cc: help-gnu-emacs
'Evening, Xah!
On Tue, Nov 25, 2008 at 12:47:17PM -0800, Xah Lee wrote:
> On Nov 25, 12:31 pm, Teemu Likonen <tliko...@iki.fi> wrote:
> > Xah Lee (2008-11-24 10:15 -0800) wrote:
> > > if cua mode is on by default in emacs 23,
> > It's not.
> my memory went faulty.
> Alan Mackenzie said that the transient-mark-mode is now on by default.
Indeed I did. When that item was being debated in emacs-devel, I argued
vigorously against it (as you can probably imagine). Yet one more reason
why we all need a .emacs.
> the other majorish change i know of is that arrow up/down now moves by
> visual line.
An improvement.
> i do hope that cua'd be on ...
Set it in your .emacs.
> ... maybe i should try to grab the emacs source... but then it's all
> the pain of compilation and problems and spending hours tech
> geeking ... EEEEE!
Compilation, the first time round, is relatively painless. But, come on,
Xah, you're an accomplished hack^H^H^H^H tech geeker, fully acquainted
with all popular OS's, especially the nice Unix-like ones. ;-) Just go
to http://savannah.gnu.org/, click on the pertinent links (you have got a
mouse, haven't you?), download Emacs-23 CVS, and build it.
> Xah
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
2008-11-24 15:03 Emacs standards with regions Richard Riley
2008-11-24 16:46 ` Xah Lee
@ 2008-11-26 8:19 ` Andreas Röhler
[not found] ` <mailman.1274.1227687564.26697.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 15+ messages in thread
From: Andreas Röhler @ 2008-11-26 8:19 UTC (permalink / raw)
To: Richard Riley; +Cc: help-gnu-emacs
Richard Riley wrote:
> Is there some reason that most emacs commands do not consider active
> region when invoked? One of the biggest UI improvements (for me) would
> be for interactive commands to default to the marked region.
>
> e.g C-s for isearch-forward
>
> Hilite "word" and "word" is the default search term. Ditto for % (search
> and replace). I just modified my py-execute-buffer for example to call
> py-execute-region with the marked region rather than the entire buffer
> if the region was active. Why have a seperate "execute-region" command?
>
> The ignoring of the region in so many key commands makes we wonder if I
> am missnig a default setting or if there was a decision not to use the
> region.
>
> e.g this Google search function I use defaults
>
> ,----
> | (defun rgr/google-search-prompt()
> | (interactive)
> | (let* ((default (region-or-word-at-point))
> | (term (read-string (format "Google the web for the following phrase (%s): "
> | default))))
> | (message "term is %s. Length is %d" term (length term))
> | (rgr/google (if (zerop(length term)) default term))
> | ))
> `----
>
>
> Can anyone add to this?
>
>
>
>
AFAIS we have to consider too different cases:
1) where the region is something like the thing searched for
2) the region marks the boundary wherein some action should take place.
You mentioned the first case. Relating to the second,
default values are not to define in general. Boundaries
may be every position, even if beginning- or
end-of-line or paragraph may occur quite often.
For my purposes I use a template, which inserts this in an assumed `let'
((beg (cond (beg beg)
((region-active-p)
(region-beginning))
(t (line-beginning-position))))
(end (cond (end (copy-marker end))
((region-active-p)
(copy-marker (region-end)))
(t (copy-marker (line-end-position))))))
Afterwards I have to change (line-beginning-position)
etc., should it not be the right thing.
`region-active-p' is defined as
(unless (featurep 'xemacs)
(defun region-active-p ()
(and mark-active transient-mark-mode
(not (eq (region-beginning) (region-end))))))
Andreas Röhler
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Emacs standards with regions
[not found] ` <mailman.1274.1227687564.26697.help-gnu-emacs@gnu.org>
@ 2008-11-26 14:45 ` Xah Lee
0 siblings, 0 replies; 15+ messages in thread
From: Xah Lee @ 2008-11-26 14:45 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 26, 12:19 am, Andreas Röhler <andreas.roeh...@easy-emacs.de>
wrote:
> Richard Riley wrote:
> > Is there some reason that most emacs commands do not consider active
> > region when invoked? One of the biggest UI improvements (for me) would
> > be for interactive commands to default to the marked region.
>
> > e.g C-s for isearch-forward
>
> > Hilite "word" and "word" is the default search term. Ditto for % (search
> > and replace). I just modified my py-execute-buffer for example to call
> > py-execute-region with the marked region rather than the entire buffer
> > if the region was active. Why have a seperate "execute-region" command?
>
> > The ignoring of the region in so many key commands makes we wonder if I
> > am missnig a default setting or if there was a decision not to use the
> > region.
>
> > e.g this Google search function I use defaults
>
> > ,----
> > | (defun rgr/google-search-prompt()
> > | (interactive)
> > | (let* ((default (region-or-word-at-point))
> > | (term (read-string (format "Google the web for the following phrase (%s): "
> > | default))))
> > | (message "term is %s. Length is %d" term (length term))
> > | (rgr/google (if (zerop(length term)) default term))
> > | ))
> > `----
>
> > Can anyone add to this?
>
> AFAIS we have to consider too different cases:
>
> 1) where the region is something like the thing searched for
> 2) the region marks the boundary wherein some action should take place.
>
> You mentioned the first case. Relating to the second,
> default values are not to define in general. Boundaries
> may be every position, even if beginning- or
> end-of-line or paragraph may occur quite often.
hum?
i don't quite understand what you were saying. I don't see what is the
difference of your (1) and (2). I don't quiet see what's (1).
generally, a function need input. If the input is a text, sometimes
that can be just the current word, line, file path, or other semantic
unit, but sometimes it is useful to let the user feed it to the
function.
Checking active region (aka text selection) is a good way to do that.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2008-11-26 14:45 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 15:03 Emacs standards with regions Richard Riley
2008-11-24 16:46 ` Xah Lee
2008-11-24 18:15 ` Xah Lee
2008-11-24 21:07 ` Eli Zaretskii
[not found] ` <mailman.1152.1227560873.26697.help-gnu-emacs@gnu.org>
2008-11-24 21:26 ` Richard Riley
2008-11-25 3:40 ` Jason Rumney
2008-11-25 10:16 ` Xah Lee
2008-11-25 15:55 ` Jason Rumney
2008-11-25 15:57 ` Richard Riley
2008-11-25 18:01 ` Reiner Steib
2008-11-25 20:31 ` Teemu Likonen
2008-11-25 20:47 ` Xah Lee
2008-11-25 23:55 ` Alan Mackenzie
2008-11-26 8:19 ` Andreas Röhler
[not found] ` <mailman.1274.1227687564.26697.help-gnu-emacs@gnu.org>
2008-11-26 14:45 ` Xah Lee
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.