emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] after execute +org-realign-table-maybe-h may move point [9.6 (9.6-??-bed47b4 @ c:/Users/yhht/.emacs.d/.local/straight/build-28.2/org/)]
@ 2023-03-10  6:21 赵一宇
  2023-03-10 12:56 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: 赵一宇 @ 2023-03-10  6:21 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

+org-realign-table-maybe-h function definition is at the end. 

Instead of using save-excursion macro, it saves current point to a var,
and restore the point after execute org-table-align.
That would cause point move visually. Although the (point) value not changed, org-table-align function shall insert  spaces in front of the point. 
Don't know if it has already fixed, or there are some other concerns.
(defun +org-realign-table-maybe-h ()
  "Auto-align table under cursor."
  (when (and org-table-automatic-realign (org-at-table-p) org-table-may-need-update)
    (let ((pt (point))
          (inhibit-message t))
      (if org-table-may-need-update (org-table-align))
      (goto-char pt))))
Emacs : GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
 of 2022-09-13
Package: Org mode version 9.6 (9.6-??-bed47b4 )


[-- Attachment #2: Type: text/html, Size: 1593 bytes --]

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

* Re: [BUG] after execute +org-realign-table-maybe-h may move point [9.6 (9.6-??-bed47b4 @ c:/Users/yhht/.emacs.d/.local/straight/build-28.2/org/)]
  2023-03-10  6:21 [BUG] after execute +org-realign-table-maybe-h may move point [9.6 (9.6-??-bed47b4 @ c:/Users/yhht/.emacs.d/.local/straight/build-28.2/org/)] 赵一宇
@ 2023-03-10 12:56 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-03-10 12:56 UTC (permalink / raw)
  To: 赵一宇; +Cc: emacs-orgmode@gnu.org

赵一宇 <zhyznd@163.com> writes:

> +org-realign-table-maybe-h function definition is at the end. 
>
> Instead of using save-excursion macro, it saves current point to a var,
> and restore the point after execute org-table-align.
> That would cause point move visually. Although the (point) value not changed, org-table-align function shall insert  spaces in front of the point. 
> Don't know if it has already fixed, or there are some other concerns.

Note that `+org-realign-table-maybe-h' it is not a function from Org
mode. Likely from Doom Emacs? Did you report to Doom Emacs repo?

`save-excursion' is not always reliable when changes are being made
around point. Sometimes, explicitly storing the (point-marker) is more
reliable. Or storing a relative position. Also, org-table.el provides
`org-table-save-field' macro for similar purposes.

Canceled.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2023-03-10 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10  6:21 [BUG] after execute +org-realign-table-maybe-h may move point [9.6 (9.6-??-bed47b4 @ c:/Users/yhht/.emacs.d/.local/straight/build-28.2/org/)] 赵一宇
2023-03-10 12:56 ` Ihor Radchenko

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).