From: Jani Nikula Date: Sun, 30 Sep 2012 07:36:12 +0000 (+0300) Subject: emacs: simplify point placement in notmuch-hello refresh X-Git-Tag: 0.15_rc1~232 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=1ecacab28fe10abf367ce4d6e4bac4a0642861e9;hp=1ecacab28fe10abf367ce4d6e4bac4a0642861e9 emacs: simplify point placement in notmuch-hello refresh notmuch-hello (called also through notmuch-hello-update, bound to '=' by default) tries to find the widget under or following point before refresh, and put the point back to the widget afterwards. The code has grown quite complicated, and has at least the following issues: 1) All the individual section functions have to include code to support point placement. If there is no such support, point is dropped to the search box. Only saved searches and all tags sections support point placement. 2) Point placement is based on widget-value. If there are two widgets with the same widget-value (for example a saved search with the same name as a tag) the point is moved to the earlier one, even if point was on the later one. 3) When first entering notmuch-hello notmuch-hello-target is nil, and point is dropped to the search box. Moving the point to the search box is annoying because the user is required to move the point before being able to enter key bindings. Simplify the code by removing all point placement based on widgets, as it does not work properly, and trying to fix that would unnecessarily complicate the code. Save current line and column before refresh, and restore them afterwards. Sometimes, if notmuch-show-empty-saved-searches is nil, and the refresh adds or removes saved searches from the list, this has the appearance of moving the point relative to the nearest widgets. This is a much smaller and less frequent problem than the ones listed above. ---