unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16296: subword.el regexps shouldn't be constants
@ 2013-12-29 23:43 Phil Sainty
  2014-01-03 18:16 ` Ted Zlatanov
  2014-01-05  5:50 ` Paul Eggert
  0 siblings, 2 replies; 5+ messages in thread
From: Phil Sainty @ 2013-12-29 23:43 UTC (permalink / raw)
  To: 16296

I notice that a recent(ish) change in subword.el changed the two
regexps (subword-forward-regexp and subword-backward-regexp) into
constants.

The reason for splitting them out into variables in the first
place was to help make subword-mode easily adaptable to other
situations where similar functionality was needed, but for different
definitions of 'subword'.

For the situation where the normal subword-forward/backward-function
values are fine and you simply need buffer-local overrides for the
regexps, this newer change would seem to be counter-productive.

Can we please revert it?

-Phil






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#16296: subword.el regexps shouldn't be constants
  2013-12-29 23:43 bug#16296: subword.el regexps shouldn't be constants Phil Sainty
@ 2014-01-03 18:16 ` Ted Zlatanov
  2014-01-03 22:08   ` Stefan Monnier
  2014-01-04 11:32   ` Phil Sainty
  2014-01-05  5:50 ` Paul Eggert
  1 sibling, 2 replies; 5+ messages in thread
From: Ted Zlatanov @ 2014-01-03 18:16 UTC (permalink / raw)
  To: Phil Sainty; +Cc: 16296

On Mon, 30 Dec 2013 12:43:10 +1300 Phil Sainty <psainty@orcon.net.nz> wrote: 

PS> I notice that a recent(ish) change in subword.el changed the two
PS> regexps (subword-forward-regexp and subword-backward-regexp) into
PS> constants.

PS> The reason for splitting them out into variables in the first
PS> place was to help make subword-mode easily adaptable to other
PS> situations where similar functionality was needed, but for different
PS> definitions of 'subword'.

PS> For the situation where the normal subword-forward/backward-function
PS> values are fine and you simply need buffer-local overrides for the
PS> regexps, this newer change would seem to be counter-productive.

PS> Can we please revert it?

For reference, you mean this commit?

revno: 113492
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13758
committer: Stefan Monnier <monnier@iro.umontreal.ca>
branch nick: trunk
timestamp: Mon 2013-07-22 12:25:32 -0400
message:
  * lisp/progmodes/subword.el: Fix boundary case.
  (subword-forward-regexp): Make it a constant.  Wrap optional \\W in its
  own group.
  (subword-backward-regexp): Make it a constant.
  (subword-forward-internal): Don't treat a trailing capital as the
  beginning of a word.
  * test/automated/subword-tests.el: New file.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#16296: subword.el regexps shouldn't be constants
  2014-01-03 18:16 ` Ted Zlatanov
@ 2014-01-03 22:08   ` Stefan Monnier
  2014-01-04 11:32   ` Phil Sainty
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2014-01-03 22:08 UTC (permalink / raw)
  To: Phil Sainty; +Cc: 16296

>   (subword-forward-regexp): Make it a constant.  Wrap optional \\W in its
>   own group.
>   (subword-backward-regexp): Make it a constant.

If there are reasons for users to change them, then feel free to revert
them to defvars.


        Stefan





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#16296: subword.el regexps shouldn't be constants
  2014-01-03 18:16 ` Ted Zlatanov
  2014-01-03 22:08   ` Stefan Monnier
@ 2014-01-04 11:32   ` Phil Sainty
  1 sibling, 0 replies; 5+ messages in thread
From: Phil Sainty @ 2014-01-04 11:32 UTC (permalink / raw)
  To: 16296

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

On 4/01/2014 11:08, Stefan Monnier wrote:
> If there are reasons for users to change them, then feel free
> to revert them to defvars.

Great, thank you.


On 4/01/2014 07:16, Ted Zlatanov wrote:
> For reference, you mean this commit?
> 
> revno: 113492
> fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13758
> committer: Stefan Monnier <monnier@iro.umontreal.ca>
> branch nick: trunk
> timestamp: Mon 2013-07-22 12:25:32 -0400
> message:
>   * lisp/progmodes/subword.el: Fix boundary case.
>   (subword-forward-regexp): Make it a constant.  Wrap optional \\W in its
>   own group.
>   (subword-backward-regexp): Make it a constant.
>   (subword-forward-internal): Don't treat a trailing capital as the
>   beginning of a word.
>   * test/automated/subword-tests.el: New file.

Yes, that's the one (although note that I'm not suggesting reverting
that entire commit; just the defvar -> defconst changes).

I've attached a patch.


-Phil



[-- Attachment #2: subword-regexp-vars.patch --]
[-- Type: text/plain, Size: 677 bytes --]

diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el
index f45b9d1..f9efa37 100644
--- a/lisp/progmodes/subword.el
+++ b/lisp/progmodes/subword.el
@@ -93,11 +93,11 @@
 (defvar subword-backward-function 'subword-backward-internal
   "Function to call for backward subword movement.")
 
-(defconst subword-forward-regexp
+(defvar subword-forward-regexp
   "\\W*\\(\\([[:upper:]]*\\(\\W\\)?\\)[[:lower:][:digit:]]*\\)"
   "Regexp used by `subword-forward-internal'.")
 
-(defconst subword-backward-regexp
+(defvar subword-backward-regexp
   "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([[:upper:]]+\\W*\\)\\|\\W\\w+\\)"
   "Regexp used by `subword-backward-internal'.")
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#16296: subword.el regexps shouldn't be constants
  2013-12-29 23:43 bug#16296: subword.el regexps shouldn't be constants Phil Sainty
  2014-01-03 18:16 ` Ted Zlatanov
@ 2014-01-05  5:50 ` Paul Eggert
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Eggert @ 2014-01-05  5:50 UTC (permalink / raw)
  To: 16296-done

I installed that patch; thanks.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-05  5:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29 23:43 bug#16296: subword.el regexps shouldn't be constants Phil Sainty
2014-01-03 18:16 ` Ted Zlatanov
2014-01-03 22:08   ` Stefan Monnier
2014-01-04 11:32   ` Phil Sainty
2014-01-05  5:50 ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).