doomemacs / doomemacs/core

After execute +org-realign-table-maybe-h may move point

Open
#7,143 1 comment 0 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [X] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [X] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [X] The issue can be reproduced on the **latest** available commit of Doom.

- [X] The issue can be reproduced on a stable release of Emacs, such as 27 or 28. *(Doom does not support development builds like 29+ or any version ending in .50 or .9x)*

### Expected behavior

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.

### Current behavior

1. Add something in a cell at line except head line, to make column wider.
2. Execute +org-realign-table-maybe-h, will see the point jumps before the previous position.

### Steps to reproduce

Maybe make change like this?

```
(defun +myfunc/org-realign-table-maybe-h (_oldfun)
"Auto-align table under cursor."
(when (and org-table-automatic-realign org-table-may-need-update)
(if (org-at-table-p)
(let ((inhibit-message t))
(save-excursion
(org-table-align)
))
(setq org-table-may-need-update nil))))
```

### System Information

https://pastebin.com/EYWvr9a8

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior in +org-realign-table-maybe-h with an Org table whose column widens, then inspect how org-table-align changes the visual position under save-excursion. Done means realignment preserves the cursor's visual position rather than moving it before the previous location.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs, emacs-lisp
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.