From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Alternative to current-column that counts from visual line beginning Date: Tue, 29 Dec 2020 16:05:06 -0500 Message-ID: <825A2F57-1C56-4B4D-B16B-2DD2AC3734D5@gmail.com> References: <87F0777E-F283-4315-B9E5-D104B145EF89@gmail.com> <9CF22BD8-B889-4859-9119-A054B1084840@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22689"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 29 22:05:57 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuMBp-0005n9-Fn for ged-emacs-devel@m.gmane-mx.org; Tue, 29 Dec 2020 22:05:57 +0100 Original-Received: from localhost ([::1]:38840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuMBo-0004Ul-I5 for ged-emacs-devel@m.gmane-mx.org; Tue, 29 Dec 2020 16:05:56 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuMB5-0003z6-JW for emacs-devel@gnu.org; Tue, 29 Dec 2020 16:05:11 -0500 Original-Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]:34294) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kuMB3-0006kY-UW; Tue, 29 Dec 2020 16:05:11 -0500 Original-Received: by mail-qk1-x736.google.com with SMTP id c7so12482388qke.1; Tue, 29 Dec 2020 13:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Qno7FSaSETmxgVv8uq3mWctg2qnmJwg/P5BHhDGHSe0=; b=QutEdKhxETy5r+0E89ciU6Y76tvS5L1Srj4sNBNoqJQZCs74fRL/bJJCO6Sbw+U3Ms 9N6uELrT/G01pF/DwWCmAO8DyAe7Y09r9FVNG16IL4f4UZOpO6QT3MggxlHZjNmUIZUI j8YhheRhwRUwUZMMwBnhLZukbfNAlEc+qvtSfG/V5CDTSGQdzbdz3U85Bdr2GPxatlZw jqwY5dTDqeRDMu25c2596xHhiZUiaSthRyhAABI5o2l7ZA31XSkj7ue/GJQevYkM5eoV 6TqzhX+07VW3QHGWrQnnDKe4VcZjf4bA1dKd8CttSlW/yyLUJ+r8ScsuuTxL+3dCEu3o 6cTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Qno7FSaSETmxgVv8uq3mWctg2qnmJwg/P5BHhDGHSe0=; b=fTW1uQSH12YsLR4GIZ6foBX1VI5iuJhDSNRgEOMTvlg8R1nsHFITSVMcrCE1ApWWtu 6HodRTAvMb+Q68yoE+xuKDFncF271v2xTI8gq2EVyA6w/TSsuka0qDCaI38O20sT8JMV RtSUzyVGv4vLsQZcgzttAAk3d2DsLBt1xWAI91VN/jJ6orfyBI/eyclHJMLDHCu/Gt8o or68B91iTCdMuOHRKag2vrZyctIGy7gl1vDuY6qGmJIZIJDXQNU4idZNT1ZQ3qL3faBF XTdMG72SpM8aAOZ0z+ZOmdH2uWfsu58Qj62Zq1Rg1XYFdMu7TH+sv/wEpF2/yjsNZeKe p1VA== X-Gm-Message-State: AOAM5325w7MRs2SW2sD2WBuXTF84B8f8V1e+giU0dTH4FrNJvOo/MYsb f87cbT3YeqhxoyKYug0ktEtwJ1XG//B+og== X-Google-Smtp-Source: ABdhPJxlYpGSUtMJdWZS7t0qZLwfdN0xHpUE6E+yLeHv7TdS1HyhC608G4elsd90QA9wotna9XGY3g== X-Received: by 2002:a05:620a:947:: with SMTP id w7mr43928811qkw.389.1609275907869; Tue, 29 Dec 2020 13:05:07 -0800 (PST) Original-Received: from ?IPv6:2601:98a:4200:9210:a4d8:20a3:82c7:acd? ([2601:98a:4200:9210:a4d8:20a3:82c7:acd]) by smtp.gmail.com with ESMTPSA id o5sm26251094qti.47.2020.12.29.13.05.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Dec 2020 13:05:07 -0800 (PST) In-Reply-To: <9CF22BD8-B889-4859-9119-A054B1084840@gnu.org> X-Mailer: Apple Mail (2.3654.40.0.2.32) Received-SPF: pass client-ip=2607:f8b0:4864:20::736; envelope-from=casouri@gmail.com; helo=mail-qk1-x736.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:262091 Archived-At: > On Dec 29, 2020, at 1:21 AM, Eli Zaretskii wrote: >=20 > On December 29, 2020 7:01:16 AM GMT+02:00, Yuan Fu = wrote: >>=20 >>=20 >>> On Dec 28, 2020, at 9:40 PM, Stefan Monnier >> wrote: >>>=20 >>>> to get the column number counting from the visual line beginning. >> Is >>>> there a function that does what I want? If not, maybe we should add >>>> one, or add an argument to current-column. >>>=20 >>> `posn-at-point`? >>>=20 >>=20 >> That works, albeit a bit convoluted comparing to current-column and >> only works when point is visible. Another less legit point is that >> posn-at-point is a bit far-fetched semantically: for me it is more >> about GUI pixel positions than text-based column and line positions. >> All things considered, I still prefer a dedicated function or an >> additional argument to current-column. >>=20 >> Yuan >=20 > The concept of "visual line" of some buffer position only makes sense = in the context of displaying the buffer in some window. That's because = window dimensions and other window-specific aspects, such as faces and = overlays, have direct and prominent effect on how physical lines are = divided into visual lines. >=20 > Therefore, I don't think I understand how can a function exist that = reports the "visual column" of a buffer position without telling it the = window in which to display that buffer. Could you perhaps outline the = algorithm for such a function? Perhaps there is some misunderstanding. I see your point. I use vertical-motion, which takes a window as = argument (and defaults to the current window). (save-excursion (let ((col (current-column))) ;; Go to visual line beginning. (vertical-motion 0) (- col (current-column)))) Yuan=