* Column-number-mode ordinality question
@ 2010-04-15 19:26 Smith_RS
2010-04-15 20:22 ` Cecil Westerhof
2010-04-15 21:06 ` Andreas Politz
0 siblings, 2 replies; 8+ messages in thread
From: Smith_RS @ 2010-04-15 19:26 UTC (permalink / raw)
To: help-gnu-emacs
I know that historically RMS was against this, but is there any way in
23.1 to change the behavior of column-number-mode so that it begins
with 1 and not 0?
Under Linux I can just change the code in xdisp.c, but I'm doing more
work with Windows these days.
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Column-number-mode ordinality question
2010-04-15 19:26 Column-number-mode ordinality question Smith_RS
@ 2010-04-15 20:22 ` Cecil Westerhof
2010-04-15 21:06 ` Andreas Politz
1 sibling, 0 replies; 8+ messages in thread
From: Cecil Westerhof @ 2010-04-15 20:22 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 366 bytes --]
Smith_RS <rsmithpv@gmail.com> writes:
> I know that historically RMS was against this, but is there any way in
> 23.1 to change the behavior of column-number-mode so that it begins
> with 1 and not 0?
>
> Under Linux I can just change the code in xdisp.c, but I'm doing more
> work with Windows these days.
I have some code that I use to display things different:
[-- Attachment #2: My modified modeline --]
[-- Type: image/png, Size: 1904 bytes --]
[-- Attachment #3: Type: text/plain, Size: 812 bytes --]
I have here combined line number and column number. (Saves modeline
estate.) I work with the default starting with 0, but it is easy to
change the code. (The blessing of OSS.) I use:
(defun buffer-position (&optional do-yank)
(let ((ret-val (format "%d,%d" (line-number-at-pos) (current-column))))
(buffer-count-exit do-yank (interactive-p) ret-val nil)))
but this could be changed to:
(defun buffer-position (&optional do-yank)
(let ((ret-val (format "%d,%d" (line-number-at-pos) (1+ (current-column)))))
(buffer-count-exit do-yank (interactive-p) ret-val nil)))
Let me know if you are interested. I did post it in the past, but it
will be better to have the latest version.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Column-number-mode ordinality question
2010-04-15 19:26 Column-number-mode ordinality question Smith_RS
2010-04-15 20:22 ` Cecil Westerhof
@ 2010-04-15 21:06 ` Andreas Politz
2010-04-15 22:22 ` Smith_RS
1 sibling, 1 reply; 8+ messages in thread
From: Andreas Politz @ 2010-04-15 21:06 UTC (permalink / raw)
To: help-gnu-emacs
Smith_RS <rsmithpv@gmail.com> writes:
> I know that historically RMS was against this, but is there any way in
> 23.1 to change the behavior of column-number-mode so that it begins
> with 1 and not 0?
>
> Under Linux I can just change the code in xdisp.c, but I'm doing more
> work with Windows these days.
>
> Thanks.
I suppose, you could change the
(propertize ... "(%l,%c)" parts in
`mode-line-position' to something like
...
(column-number-mode
(10 (:eval
(propertize
(format " (%l,%d)" (1+ (current-column)))
'local-map mode-line-column-line-number-mode-map
'mouse-face 'mode-line-highlight
'help-echo "Line number and Column number\n\
mouse-1: Display Line and Column Mode Menu")))
...
-ap
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Column-number-mode ordinality question
2010-04-15 21:06 ` Andreas Politz
@ 2010-04-15 22:22 ` Smith_RS
2010-04-16 1:17 ` Smith_RS
2010-04-19 21:32 ` Glenn Morris
0 siblings, 2 replies; 8+ messages in thread
From: Smith_RS @ 2010-04-15 22:22 UTC (permalink / raw)
To: help-gnu-emacs
Andreas,
Thanks, but I tried directly hacking bindings.el, re-compiling
the .elc, and it didn't change anything.
Is there something special about 23.1 for Windows? Is there some sort
of weird caching going on?
On Apr 15, 5:06 pm, Andreas Politz <poli...@fh-trier.de> wrote:
> Smith_RS <rsmit...@gmail.com> writes:
> > I know that historically RMS was against this, but is there any way in
> > 23.1 to change the behavior of column-number-mode so that it begins
> > with 1 and not 0?
>
> > Under Linux I can just change the code in xdisp.c, but I'm doing more
> > work with Windows these days.
>
> > Thanks.
>
> I suppose, you could change the
>
> (propertize ... "(%l,%c)" parts in
>
> `mode-line-position' to something like
>
> ...
> (column-number-mode
> (10 (:eval
> (propertize
> (format " (%l,%d)" (1+ (current-column)))
> 'local-map mode-line-column-line-number-mode-map
> 'mouse-face 'mode-line-highlight
> 'help-echo "Line number and Column number\n\
> mouse-1: Display Line and Column Mode Menu")))
> ...
>
> -ap
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Column-number-mode ordinality question
2010-04-15 22:22 ` Smith_RS
@ 2010-04-16 1:17 ` Smith_RS
2010-04-17 0:22 ` Johan Bockgård
2010-04-19 21:32 ` Glenn Morris
1 sibling, 1 reply; 8+ messages in thread
From: Smith_RS @ 2010-04-16 1:17 UTC (permalink / raw)
To: help-gnu-emacs
I got a little further. Instead of hacking directly on bindings.el I
located bindings+.el, put it in site-lisp, and that overrode things
the right way.
The problem is that the "eval" construct doesn't get eval'd every time
the cursor moves.
Also, you can't mix %l and $d in a format that way. I tried this and
it didn't work:
(10 (:eval
(propertize
(format " (%d,%d)" (current-line) (1+ (current-column)))
'local-map mode-line-column-line-number-mode-map
'mouse-face 'mode-line-highlight
This works better but does not update frequently enough:
(5 (:eval
(propertize
(format " C%d" (1+ (current-column)))
'local-map mode-line-column-line-number-mode-map
'mouse-face 'mode-line-highlight
It's close, but not quite.
On Apr 15, 6:22 pm, Smith_RS <rsmit...@gmail.com> wrote:
> Andreas,
>
> Thanks, but I tried directly hacking bindings.el, re-compiling
> the .elc, and it didn't change anything.
>
> Is there something special about 23.1 for Windows? Is there some sort
> of weird caching going on?
>
> On Apr 15, 5:06 pm, Andreas Politz <poli...@fh-trier.de> wrote:
>
> > Smith_RS <rsmit...@gmail.com> writes:
> > > I know that historically RMS was against this, but is there any way in
> > > 23.1 to change the behavior of column-number-mode so that it begins
> > > with 1 and not 0?
>
> > > Under Linux I can just change the code in xdisp.c, but I'm doing more
> > > work with Windows these days.
>
> > > Thanks.
>
> > I suppose, you could change the
>
> > (propertize ... "(%l,%c)" parts in
>
> > `mode-line-position' to something like
>
> > ...
> > (column-number-mode
> > (10 (:eval
> > (propertize
> > (format " (%l,%d)" (1+ (current-column)))
> > 'local-map mode-line-column-line-number-mode-map
> > 'mouse-face 'mode-line-highlight
> > 'help-echo "Line number and Column number\n\
> > mouse-1: Display Line and Column Mode Menu")))
> > ...
>
> > -ap
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Column-number-mode ordinality question
2010-04-16 1:17 ` Smith_RS
@ 2010-04-17 0:22 ` Johan Bockgård
0 siblings, 0 replies; 8+ messages in thread
From: Johan Bockgård @ 2010-04-17 0:22 UTC (permalink / raw)
To: help-gnu-emacs
Smith_RS <rsmithpv@gmail.com> writes:
> The problem is that the "eval" construct doesn't get eval'd every time
> the cursor moves.
The mode line is caused to be updated more often by the %c construct. If
you remove it you have to trigger an update some other way.
> Also, you can't mix %l and $d in a format that way.
You can add another % to protect the %-sequence.
(setq mode-line-format
`((-1 (:propertize "%c" face (:height 0)))
(10 (:propertize
(:eval (format " (%%l,%d)" (1+ (current-column))))
local-map ,mode-line-column-line-number-mode-map
mouse-face mode-line-highlight))))
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Column-number-mode ordinality question
2010-04-15 22:22 ` Smith_RS
2010-04-16 1:17 ` Smith_RS
@ 2010-04-19 21:32 ` Glenn Morris
2010-04-21 1:19 ` Smith_RS
1 sibling, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2010-04-19 21:32 UTC (permalink / raw)
To: help-gnu-emacs
Smith_RS wrote:
> Thanks, but I tried directly hacking bindings.el, re-compiling
> the .elc, and it didn't change anything.
>
> Is there something special about 23.1 for Windows? Is there some sort
> of weird caching going on?
For the record; bindings is compiled into the executable (on all
platforms), therefore you would have to rebuild Emacs to change it in
this way.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Column-number-mode ordinality question
2010-04-19 21:32 ` Glenn Morris
@ 2010-04-21 1:19 ` Smith_RS
0 siblings, 0 replies; 8+ messages in thread
From: Smith_RS @ 2010-04-21 1:19 UTC (permalink / raw)
To: help-gnu-emacs
I downloaded MinGW, tweeked the code in xdisp.c that controls %c, and
rebuilt.
I now get the "All (1,1)" when I open a new buffer window, which is as
it should be. :)
Thanks for all the replies.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-04-21 1:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-15 19:26 Column-number-mode ordinality question Smith_RS
2010-04-15 20:22 ` Cecil Westerhof
2010-04-15 21:06 ` Andreas Politz
2010-04-15 22:22 ` Smith_RS
2010-04-16 1:17 ` Smith_RS
2010-04-17 0:22 ` Johan Bockgård
2010-04-19 21:32 ` Glenn Morris
2010-04-21 1:19 ` Smith_RS
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.