all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Gregory Heytings <gregory@heytings.org>
Cc: monnier@iro.umontreal.ca, help-gnu-emacs@gnu.org
Subject: Re: How to get the current column regardless of the content of the current line?
Date: Fri, 16 Dec 2022 09:10:18 +0200	[thread overview]
Message-ID: <83o7s3ken9.fsf@gnu.org> (raw)
In-Reply-To: <da0c324f2be5566e3de6@heytings.org> (message from Gregory Heytings on Thu, 15 Dec 2022 22:02:59 +0000)

> Date: Thu, 15 Dec 2022 22:02:59 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: help-gnu-emacs@gnu.org
> 
> 
> >> (defun my/current-column ()
> >>   (- (point) (save-excursion (beginning-of-line) (point))))
> >               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >               (line-beginning-position)
> >
> > -- Stefan
> >
> 
> Indeed.  Or even 'pos-bol':
> 
> (defun my/current-column ()
>    (- (point) (pos-bol)))

It's not entirely correct to call this a "column", though...



  reply	other threads:[~2022-12-16  7:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 19:22 How to get the current column regardless of the content of the current line? Rodrigo Morales
2022-12-15 21:37 ` Gregory Heytings
2022-12-15 21:41   ` Gregory Heytings
2022-12-15 21:56     ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-12-15 22:00       ` Emanuel Berg
2022-12-15 22:02       ` Gregory Heytings
2022-12-16  7:10         ` Eli Zaretskii [this message]
2022-12-16  8:52           ` Gregory Heytings
2022-12-16 21:43             ` Emanuel Berg
2022-12-16  3:28     ` Rodrigo Morales
2022-12-16  5:12 ` Jean Louis
2022-12-16 17:44   ` Rodrigo Morales
2022-12-17  4:07     ` Jean Louis
2022-12-17  5:11       ` Emanuel Berg
2022-12-17  5:53         ` Emanuel Berg

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

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

  git send-email \
    --in-reply-to=83o7s3ken9.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gregory@heytings.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 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.