unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23863: 25.0.94; `delete-duplicate-lines' ignores first line in when REVERSE is non-nil
@ 2016-06-28 19:43 Adrián Medraño Calvo
  2016-06-29  9:04 ` Stephen Berman
  0 siblings, 1 reply; 4+ messages in thread
From: Adrián Medraño Calvo @ 2016-06-28 19:43 UTC (permalink / raw)
  To: 23863

When running `delete-duplicate-lines' in reverse mode (i.e., REVERSE is
non-nil) the topmost line is not deleted.  Please, see recipe:

1. Place the following lines in a buffer:

This is line A.
This is line B.
This is line A.
This is line C.
This is line A.

2. Select all the lines
3. Invoke "C-u M-x delete-duplicate-lines".
4. Result is:

This is line A.
This is line B.
This is line C.
This is line A.

The top line "This is line A." should have been deleted.

Thank you,
Adrián Medraño Calvo.

---

In GNU Emacs 25.0.94.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2016-05-18 built on amclap
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description:	Ubuntu 14.04.4 LTS

Configured using:
 'configure --prefix=/build/stow/emacs 'CFLAGS=-g3 -Og''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_MONETARY: de_DE.UTF-8
  value of $LC_NUMERIC: de_DE.UTF-8
  value of $LC_TIME: de_DE.UTF-8
  value of $LANG: en_US
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Deleted 1 duplicate line backward
Undo!
Mark set
Deleted 2 duplicate lines backward
C-x C-g is undefined
Undo!
Making completion list...
Type C-x 1 to delete the help window, C-M-v to scroll help.
Mark set [85 times]
Making completion list...

Load-path shadows:
None found.

Features:
(shadow mail-extr emacsbug message dired format-spec rfc822 mml mml-sec
password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils thingatpt help-fns
help-mode easymenu cl-loaddefs pcase cl-lib sort time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 89582 8685)
 (symbols 48 19872 0)
 (miscs 40 413 411)
 (strings 32 15134 4303)
 (string-bytes 1 445930)
 (vectors 16 12161)
 (vector-slots 8 437990 5299)
 (floats 8 166 156)
 (intervals 56 349 2)
 (buffers 976 13)
 (heap 1024 27743 554))





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

* bug#23863: 25.0.94; `delete-duplicate-lines' ignores first line in when REVERSE is non-nil
  2016-06-28 19:43 bug#23863: 25.0.94; `delete-duplicate-lines' ignores first line in when REVERSE is non-nil Adrián Medraño Calvo
@ 2016-06-29  9:04 ` Stephen Berman
  2016-07-13 15:29   ` Adrián Medraño Calvo
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Berman @ 2016-06-29  9:04 UTC (permalink / raw)
  To: Adrián Medraño Calvo; +Cc: 23863

On Tue, 28 Jun 2016 21:43:48 +0200 Adrián Medraño Calvo <adrian@medranocalvo.com> wrote:

> When running `delete-duplicate-lines' in reverse mode (i.e., REVERSE is
> non-nil) the topmost line is not deleted.  Please, see recipe:
>
> 1. Place the following lines in a buffer:
>
> This is line A.
> This is line B.
> This is line A.
> This is line C.
> This is line A.
>
> 2. Select all the lines
> 3. Invoke "C-u M-x delete-duplicate-lines".
> 4. Result is:
>
> This is line A.
> This is line B.
> This is line C.
> This is line A.
>
> The top line "This is line A." should have been deleted.

The patch below fixes this.  This bug has existed since the command
was introduced in Emacs 24, i.e., it's not a regression in Emacs 25, so
if the patch is acceptable, should it be pushed to master?

Steve Berman

diff --git a/lisp/sort.el b/lisp/sort.el
index 4d7311f..8bc7138 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -596,7 +596,7 @@ delete-duplicate-lines
 	   (equal current-prefix-arg '(64))
 	   t)))
   (let ((lines (unless adjacent (make-hash-table :test 'equal)))
-	line prev-line
+	line prev-line first-line
 	(count 0)
 	(beg (copy-marker beg))
 	(end (copy-marker end)))
@@ -604,8 +604,9 @@ delete-duplicate-lines
       (goto-char (if reverse end beg))
       (if (and reverse (bolp)) (forward-char -1))
       (while (if reverse
-		 (and (> (point) beg) (not (bobp)))
+		 (not first-line)
 	       (and (< (point) end) (not (eobp))))
+	(setq first-line (and reverse (or (<= (point) beg) (bobp))))
 	(setq line (buffer-substring-no-properties
 		    (line-beginning-position) (line-end-position)))
         (if (and keep-blanks (string= "" line))





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

* bug#23863: 25.0.94; `delete-duplicate-lines' ignores first line in when REVERSE is non-nil
  2016-06-29  9:04 ` Stephen Berman
@ 2016-07-13 15:29   ` Adrián Medraño Calvo
  2016-07-14  8:13     ` Stephen Berman
  0 siblings, 1 reply; 4+ messages in thread
From: Adrián Medraño Calvo @ 2016-07-13 15:29 UTC (permalink / raw)
  To: Stephen Berman, Adrián Medraño Calvo; +Cc: 23863

On 06/29/2016 11:04 AM, Stephen Berman wrote:
> 
> The patch below fixes this.  This bug has existed since the command
> was introduced in Emacs 24, i.e., it's not a regression in Emacs 25, so
> if the patch is acceptable, should it be pushed to master?

Yes, it fixes it.  Thank you!

Kind regards,

Adrián Medraño Calvo





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

* bug#23863: 25.0.94; `delete-duplicate-lines' ignores first line in when REVERSE is non-nil
  2016-07-13 15:29   ` Adrián Medraño Calvo
@ 2016-07-14  8:13     ` Stephen Berman
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Berman @ 2016-07-14  8:13 UTC (permalink / raw)
  To: Adrián Medraño Calvo; +Cc: 23863-done

fixed 23863 25.2
thanks

On Wed, 13 Jul 2016 17:29:43 +0200 Adrián Medraño Calvo <adrian@medranocalvo.com> wrote:

> On 06/29/2016 11:04 AM, Stephen Berman wrote:
>> 
>> The patch below fixes this.  This bug has existed since the command
>> was introduced in Emacs 24, i.e., it's not a regression in Emacs 25, so
>> if the patch is acceptable, should it be pushed to master?
>
> Yes, it fixes it.  Thank you!

Thanks for confirming.  Since no objection to the patch was voiced, I've
pushed it to master as commit a8e1414c and am closing this bug.

Steve Berman





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

end of thread, other threads:[~2016-07-14  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28 19:43 bug#23863: 25.0.94; `delete-duplicate-lines' ignores first line in when REVERSE is non-nil Adrián Medraño Calvo
2016-06-29  9:04 ` Stephen Berman
2016-07-13 15:29   ` Adrián Medraño Calvo
2016-07-14  8:13     ` Stephen Berman

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).