unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#58712: Incorrect vtable edges recognizing
@ 2022-10-22  7:21 lamppilutti--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-11-24 20:01 ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: lamppilutti--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-10-22  7:21 UTC (permalink / raw)
  To: 58712


[-- Attachment #1.1: Type: text/plain, Size: 317 bytes --]

Functions `vtable-beginning-of-table' and `vtable-beginning-of-table' recognize
edges incorrectly. Because of this `vtable-narrow-current-column',
`vtable-widen-current-column', `vtable-sort-by-current-column' and
`vtable-header-line-sort' remove all text before and after the table.
There is small patch to fix this.

[-- Attachment #1.2: Type: text/html, Size: 430 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-vtable-edges-recognizing.patch --]
[-- Type: text/x-patch; name=0001-Fix-vtable-edges-recognizing.patch, Size: 1333 bytes --]

From e9d4afecf512b4b7317b5cae93348c1346bf02d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A4mppi=20L=C3=BCtti?= <lamppilutti@protonmail.com>
Date: Sat, 22 Oct 2022 07:58:46 +0300
Subject: [PATCH] Fix vtable edges recognizing

* Fix `vtable-beginning-of-table' returns point-min, if point is on
  table or on one position before.

* Fix `vtable-end-of-table' returns point-max, if point is on table.
---
 lisp/emacs-lisp/vtable.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el
index de8503a1cb..20f88ed33a 100644
--- a/lisp/emacs-lisp/vtable.el
+++ b/lisp/emacs-lisp/vtable.el
@@ -240,13 +240,14 @@ See info node `(vtable)Top' for vtable documentation."

 (defun vtable-beginning-of-table ()
   "Go to the start of the current table."
-  (if (text-property-search-backward 'vtable (vtable-current-table))
+  (if (or (text-property-search-backward 'vtable (vtable-current-table) #'eq)
+          (get-text-property (point) 'vtable))
       (point)
     (goto-char (point-min))))

 (defun vtable-end-of-table ()
   "Go to the end of the current table."
-  (if (text-property-search-forward 'vtable (vtable-current-table))
+  (if (text-property-search-forward 'vtable (vtable-current-table) #'eq)
       (point)
     (goto-char (point-max))))

--
2.38.1

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

* bug#58712: Incorrect vtable edges recognizing
  2022-10-22  7:21 bug#58712: Incorrect vtable edges recognizing lamppilutti--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-11-24 20:01 ` Stefan Kangas
  2022-11-25 13:08   ` bug#58712: Ответ: " lamppilutti--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kangas @ 2022-11-24 20:01 UTC (permalink / raw)
  To: Lämppi Lütti; +Cc: 58712

Lämppi Lütti <lamppilutti@protonmail.com> writes:

> Functions `vtable-beginning-of-table' and `vtable-beginning-of-table' recognize
> edges incorrectly. Because of this `vtable-narrow-current-column',
> `vtable-widen-current-column', `vtable-sort-by-current-column' and
> `vtable-header-line-sort' remove all text before and after the table.
>
> There is small patch to fix this.

Do you have a recipe to reproduce this issue?  That would make it easier
to test the patch.  Thanks in advance.





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

* bug#58712: Ответ: Re: bug#58712: Incorrect vtable edges recognizing
  2022-11-24 20:01 ` Stefan Kangas
@ 2022-11-25 13:08   ` lamppilutti--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-07 20:27     ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: lamppilutti--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-11-25 13:08 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 58712

> Lämppi Lütti lamppilutti@protonmail.com writes:
> 
> > Functions `vtable-beginning-of-table' and` vtable-beginning-of-table' recognize
> > edges incorrectly. Because of this `vtable-narrow-current-column',` vtable-widen-current-column', `vtable-sort-by-current-column' and` vtable-header-line-sort' remove all text before and after the table.
> > 
> > There is small patch to fix this.
> 
> 
> Do you have a recipe to reproduce this issue? That would make it easier
> to test the patch. Thanks in advance.

Steps for reproduce the bag:

1. Open buffer and insert some lines in it.
2. With cursor between the lines do M-x eval-expression RET
   (make-vtable :objects '(("Foo" 1034) ("Gazonk" 45))).
3. With cursor on the table do M-x vtable-sort-by-current-collumn several
   times (or any other function listed in first letter).

Without the patch lines above and below the table will be removed.





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

* bug#58712: Incorrect vtable edges recognizing
  2022-11-25 13:08   ` bug#58712: Ответ: " lamppilutti--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-07 20:27     ` Stefan Kangas
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Kangas @ 2023-09-07 20:27 UTC (permalink / raw)
  To: Lämppi Lütti; +Cc: 58712-done

Version: 30.1

Lämppi Lütti <lamppilutti@protonmail.com> writes:

> 1. Open buffer and insert some lines in it.
> 2. With cursor between the lines do M-x eval-expression RET
>    (make-vtable :objects '(("Foo" 1034) ("Gazonk" 45))).
> 3. With cursor on the table do M-x vtable-sort-by-current-collumn several
>    times (or any other function listed in first letter).
>
> Without the patch lines above and below the table will be removed.

Thanks for the reproducer, with that I was able to reproduce the bug and
confirm that your patch fixes it.

Installed on master as commit 55c2180d2c3.





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

end of thread, other threads:[~2023-09-07 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22  7:21 bug#58712: Incorrect vtable edges recognizing lamppilutti--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-24 20:01 ` Stefan Kangas
2022-11-25 13:08   ` bug#58712: Ответ: " lamppilutti--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-07 20:27     ` Stefan Kangas

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

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