unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ken Manheimer" <ken.manheimer@gmail.com>
Subject: Re: need option so line-move-to-column ignores fields, plus patch
Date: Thu, 31 Aug 2006 12:25:32 -0400	[thread overview]
Message-ID: <2cd46e7f0608310925t38a3e24fk81982675be954448@mail.gmail.com> (raw)
In-Reply-To: <2cd46e7f0608310848l743430e9ia7a1d45e22428083@mail.gmail.com>

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

dang, my fix is not as simple or straight forwards as i hoped.

line-move-finish duplicates some of the provision for fields.  i don't
understand why, but  it only changes the resulting column
occasionally, but then in the same way as before.  the upshot is that,
without an additional change, the cursor winds up in column 0
occasionally.

my additional change accounts for that without preventing proper
handling of intangible text, which is mixed together with the
inter-line fielded text provision in line-move-finish.  i've tested it
and established that the intangible provision still works regardless,
and the field-insensitivity is complete when line-move-ignore-fields
is t.

i also made line-move-ignore-fields buffer-local, in keeping with the
judgement that this is a provision for modes, not users.

here's the new version of the ChangeLog entry, and the new version of
the patch is attached:

2006-08-22  Ken Manheimer  <ken.manheimer@gmail.com>

	* simple.el (line-move-ignore-fields): New internal variable for
	overriding line-move-finish and line-move-to-column' sensitivity
	to fields when doing column positioning.
	(line-move-finish): Respect line-move-ignore-fields.
	(line-move-to-column): Respect line-move-ignore-fields.

On 8/31/06, Ken Manheimer <ken.manheimer@gmail.com> wrote:
> i propose a change to the way line-move-to-column to enable
> insensitivity to fields.  without this change, modes that make certain
> uses of fields sacrifice column retention in line motion.  i consider
> that a bug, and this a bug fix.
>
> in my under-development allout extensions, i'm using field boundaries
> to distinguish between an outline item's structural elements (the
> guide lines and topic bullet area) and the item's content,
> specifically the content on the item's head line:
>
> | | | > here's the content.  the stuff before "here's" is the bullet
> and guidelines.
>
> this is working exactly as i need - cursor motion from within the
> headline content stops when it first hits the start of the content,
> yet will move into the structure area (for hot-spot navigation) with a
> subsequent ^A.
>
> the bug is that i can't use text fields this way without sacrificing
> column retention on line moves, as far as i can tell.
> line-move-to-column is hard-wired to respect fields when seeking the
> prior positions column, so that moving the cursor between topics
> usually leaves the cursor at column 0, which is almost always not what
> the user wants.
>
> my patch introduces a new lisp-level variable,
> `line-move-ignore-fields', and a condition in line-move-to-column to
> obey that variable.  the default setting of line-move-ignore-fields is
> nil, so the current behavior remains.  my allout extension sets it to
> get the behavior it needs.
>
> (i made it a lisp-level rather than customization variable because i
> expect that it's a modal, not user policy.  i feel the same way about
> line-move-ignore-invisible, though, so i'm breaking with that
> precedent, and could be persuaded to have the variable i'm introducing
> be customizable.)
>
> i would be interested to hear if i missed some better way to achieve
> either the cursor motion i want in the headline, without using fields,
> or have column retention without adding the field sensitivity
> inhibition, as i'm doing.  barring that, i think this is a necessary
> bug fix.
>
> the patch is attached, and here's the ChangeLog entry:
>
> 2006-08-22  Ken Manheimer  <ken.manheimer@gmail.com>
>
>         * simple.el (line-move-ignore-fields): New lisp-level variable for
>         overriding line-move-to-column's sensitivity to fields when doing
>         column positioning.
>         (line-move-to-column): Respect line-move-ignore-fields.

-- 
ken
ken.manheimer@gmail.com
http://myriadicity.net

[-- Attachment #2: line-move-patch.txt --]
[-- Type: text/plain, Size: 1170 bytes --]

--- simple.el	22 Aug 2006 17:54:52 -0400	1.812
+++ simple.el	31 Aug 2006 12:21:47 -0400	
@@ -3466,6 +3466,10 @@
   :type 'boolean
   :group 'editing-basics)
 
+(defvar line-move-ignore-fields nil
+  "*Non-nil means \\[next-line] and \\[previous-line] ignore fields.")
+(make-variable-buffer-local 'line-move-ignore-fields)
+
 (defun line-move-invisible-p (pos)
   "Return non-nil if the character after POS is currently invisible."
   (let ((prop
@@ -3683,7 +3687,8 @@
 	(goto-char opoint)
 	(let ((inhibit-point-motion-hooks nil))
 	  (goto-char
-	   (constrain-to-field new opoint nil t
+	   (constrain-to-field new (if line-move-ignore-fields new opoint)
+			       nil t
 			       'inhibit-line-move-field-capture)))
 
 	;; If all this moved us to a different line,
@@ -3702,7 +3707,8 @@
     (let ((opoint (point)))
       (move-to-column col)
       ;; move-to-column doesn't respect field boundaries.
-      (goto-char (constrain-to-field (point) opoint))))
+      (if (not line-move-ignore-fields)
+          (goto-char (constrain-to-field (point) opoint)))))
 
   (when (and line-move-ignore-invisible
 	     (not (bolp)) (line-move-invisible-p (1- (point))))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2006-08-31 16:25 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-31 15:48 need option so line-move-to-column ignores fields, plus patch Ken Manheimer
2006-08-31 16:25 ` Ken Manheimer [this message]
2006-08-31 17:11 ` David Kastrup
2006-08-31 22:57 ` Richard Stallman
2006-09-01  4:17   ` Miles Bader
2006-09-01  6:39     ` Ken Manheimer
2006-09-03 15:17       ` Richard Stallman
2006-09-04  4:43         ` Ken Manheimer
2006-09-04 17:18           ` Richard Stallman
2006-09-04 19:56             ` Ken Manheimer
2006-09-06  8:49               ` Richard Stallman
2006-09-06 16:52                 ` Ken Manheimer
2006-09-07  6:54                   ` Richard Stallman
2006-09-07 14:47                     ` Ken Manheimer
2006-09-23 23:29                       ` Ken Manheimer
2006-09-24 16:28                         ` Richard Stallman
2006-09-24 20:17                           ` Ken Manheimer
2006-09-25 20:48                             ` Richard Stallman
2006-09-24 22:04                           ` Chong Yidong
2006-09-24 22:10                             ` Chong Yidong
2006-09-25  1:53                               ` Ken Manheimer
2006-10-11  4:13                                 ` Ken Manheimer
2006-10-11 18:50                                   ` Richard Stallman
2006-10-11 19:19                                     ` Ken Manheimer
2006-10-12 22:37                                       ` Richard Stallman
2006-09-25  1:31                             ` Ken Manheimer
2006-09-25  8:36                             ` Slawomir Nowaczyk
2006-09-25 20:48                             ` Richard Stallman
2006-09-25 21:43                               ` Chong Yidong
2006-09-27 17:18                                 ` Ken Manheimer
2006-09-29 16:32                                 ` Richard Stallman
2006-09-29 18:21                                   ` Chong Yidong
2006-09-07  6:54                   ` Richard Stallman
2006-09-07 14:27                     ` Ken Manheimer
2006-09-05  4:48         ` Miles Bader
2006-09-01  6:30   ` Ken Manheimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2cd46e7f0608310925t38a3e24fk81982675be954448@mail.gmail.com \
    --to=ken.manheimer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).