unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37174: 26.2; Stabilize tabulated-list reversed sort
@ 2019-08-24 14:27 Johan Claesson
  2019-09-20 22:09 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Claesson @ 2019-08-24 14:27 UTC (permalink / raw)
  To: 37174



Hi,

Sorting with S multiple times in a tabulated-list buffer should be
stable but will sometimes reorder entries with the same value.  When the
sort order is reversed the function tabulated-list--get-sorter will
transform the sort function to sort the other way around by negating.  I
think this is what cause the needless reordering and that it should be
changed something like the following:

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 63ae1f8c07..f30e2c0ec8 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -373,7 +373,7 @@ tabulated-list--get-sorter
                                   (if (stringp b) b (car b)))))))
       ;; Reversed order.
       (if (cdr tabulated-list-sort-key)
-          (lambda (a b) (not (funcall sorter a b)))
+          (lambda (a b) (funcall sorter b a))
         sorter))))
 
 (defsubst tabulated-list--col-local-max-widths (col)



Recipe for 26.2 or 27.0 (42f8fa8070):

emacs -Q a.el b.el

C-x C-b (pop buffer list buffer)

Goto buffer list buffer and put point in "Mode" column.

Press S to sort on Mode.  b.el is now before a.el in the list.

Press S twice more.  a.el is now before b.el.

Regards,

/Johan






In GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.4)
 of 2019-04-22 built on goblin
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description:	Ubuntu 19.04

Recent messages:
((1 . b) (1 . a) (2 . b) (2 . a))
0.001_013s ((1 . b) (1 . a) (2 . b) (2 . a))
Saving file /ssd/home/jcl/share/elisp/picpocket.el...
Wrote /ssd/home/jcl/share/elisp/picpocket.el
Saving file /ssd/home/jcl/share/elisp/jcl-bugfix.el...
Wrote /ssd/home/jcl/share/elisp/jcl-bugfix.el
Quit
Saving file /ssd/home/jcl/build/emacs/lisp/emacs-lisp/tabulated-list.el...
Wrote /ssd/home/jcl/build/emacs/lisp/emacs-lisp/tabulated-list.el
C-2 C-g is undefined

Configured using:
 'configure --prefix=/ssd/home/jcl/usr --with-x-toolkit=gtk3
 --with-xwidgets --without-compress-install --with-modules
 PKG_CONFIG_PATH=/home/jcl/usr/lib/pkgconfig'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS
LIBSYSTEMD LCMS2

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

Major mode: Emacs-Lisp

Minor modes in effect:
  semantic-minor-modes-format: ((:eval (if (or semantic-highlight-edits-mode semantic-show-unmatched-syntax-mode)  S)))
  bug-reference-prog-mode: t
  global-magit-file-mode: t
  magit-file-mode: t
  magit-auto-revert-mode: t
  display-time-mode: t
  minibuffer-depth-indicate-mode: t
  save-place-mode: t
  minibuffer-electric-default-mode: t
  icomplete-mode: t
  diff-auto-refine-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  auto-revert-mode: t
  whitespace-mode: t
  winner-mode: t
  ido-everywhere: t
  num3-mode: t
  which-function-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  prettify-symbols-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
/home/jcl/elpa/soap-client-3.1.5/soap-inspect hides /ssd/home/jcl/build/emacs-26.2/lisp/net/soap-inspect
/home/jcl/elpa/soap-client-3.1.5/soap-client hides /ssd/home/jcl/build/emacs-26.2/lisp/net/soap-client
/home/jcl/elpa/let-alist-1.0.6/let-alist hides /ssd/home/jcl/build/emacs-26.2/lisp/emacs-lisp/let-alist

Features:
(shadow emacsbug reposition cl-format-def rect benchmark tree-widget
inferior-slime slime-cl-indent elp gud apropos company-dabbrev
company-template company pcase edmacro hydra lv autoload tar-mode
two-column iso-transl srecode/srt-mode semantic/analyze semantic/sort
semantic/scope semantic/analyze/fcn semantic/db semantic/format
srecode/template srecode/srt-wy semantic/wisent semantic/wisent/wisent
semantic/ctxt srecode/ctxt semantic/tag-ls semantic/find srecode/compile
srecode/dictionary srecode/table srecode eieio-base semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
cedet find-dired w3m-cookie cl-print macrostep-c cmacexp tabify
hippie-exp eieio-opt speedbar sb-image ezimage dframe help-fns
radix-tree bug-reference w3m-form w3m-symbol pulse check-declare
gnus-dired flow-fill url-cache mailalias dabbrev cl-indent char-fold
misearch multi-isearch org-duration cal-move time-stamp gnus-cite
mm-archive mail-extr gnus-async smiley jcl-replace jcl-games-init
jcl-muse-init htmlize-hack htmlize muse-latex muse-html muse-xml-common
muse-colors cus-edit cus-start cus-load muse-publish muse-project
muse-protocols muse-regexps muse muse-nested-tags muse-mode jcl-w3m-init
w3m-search w3m-bookmark w3m-antenna w3m-rss jcl-yaoddmuse-init
yaoddmuse-extension yaoddmuse skeleton sgml-mode org-rmail org-mhe
org-irc org-info org-gnus nnir org-docview org-bibtex bibtex org-bbdb
org-w3m jcl-renegade-goblin jcl-home-boot elec-pair network-stream
erlang-test jcl-load jcl-magit-init magit-bookmark magit-submodule
magit-obsolete magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode
magit-core magit-autorevert magit-margin magit-transient magit-process
magit-mode transient jcl-billboard-init jcl-dir-local-init jcl-rfc-init
rfcview goto-addr jcl-file-cache-test jcl-file-cache-init
jcl-package-lint-init package-lint finder lisp-mnt typing-practice
jcl-elisp-init lib-requires profiler jcl-grep-init jcl-abbrev-init
jcl-ediff-init jcl-term-init jcl-erlang-init erldoc jcl-sbg
jcl-erlang-log bookmark jcl-erlang-man man jcl-midnite-init
jcl-sbg-compile-test sbg jcl-midnite jcl-mailme midnight
jcl-picpocket-init picpocket-test jcl-erc-init jcl-ido-init
jcl-dired-init image-file ls-lisp wdired jcl-register-init
jcl-command-subset-init jcl-generic-init generic-x jcl-eww-init eww
url-queue shr svg dom jcl-org-init poporg ob-latex ox-beamer org-feed
org-capture jcl-shell-init jcl-google-init jcl-c-init cwarn
jcl-modes-init hexl checkdoc vc-dir vc vc-dispatcher vc-git
gitconfig-mode conf-mode calc calc-loaddefs calc-macs proced nroff-mode
picture markdown-mode rx color make-mode python tramp-sh jcl-ruby
inf-ruby ruby-mode fpl grep jcl-elpa-init ffap view jcl-global-init time
printing ps-print ps-print-loaddefs ps-def lpr mb-depth saveplace
face-remap minibuf-eldef icomplete jcl-keys-init kmacro diff-mode
jcl-sbg-ssit wiki-summary jcl-file-cache filecache jcl-google
google-translate google-translate-default-ui google-translate-core-ui
google-translate-core google-translate-tk google-translate-backend
jcl-imenu jcl-wesnoth wesnoth-mode wesnoth-wml-data wesnoth-update
jcl-erlang jcl-sbg-compile jcl-picpocket jcl-goblin jcl-dired
fuzzy-match jcl-ediff jcl-elisp jcl-grep edebug jcl-stumpwm jcl-org
jcl-erc erc-goodies erc erc-backend erc-compat jcl-vbox jcl-lxc jcl-keys
tramp tramp-compat tramp-loaddefs trampver ucs-normalize windmove
jcl-debbugs-init debbugs-org debbugs-gnu debbugs soap-client url-http
url-auth url-gw nsm warnings rng-xsd xsd-regexp jcl-epresent-init
jcl-epresent org-indent epresent ox-odt rng-loc rng-uri rng-parse
rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok
nxml-util ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox
jcl-isearch jcl-bugfix loadhist git-commit with-editor async-bytecomp
async shell magit-git magit-section magit-utils crm log-edit pcvs-util
add-log dash jcl-bugfix-complete-at-eob jcl-bugfix-xref jcl-merge
jcl-wip jcl-work-buffer ediff-merg ediff-wind ediff-diff ediff-mult
ediff-help ediff-init ediff-util ediff jcl-sty jcl-template
jcl-copyright jcl-template-lib cperl-mode cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs erlang
tempo align wc-mode jcl-register jcl-term ange-ftp jcl-advice
jcl-command-subset jcl-duff clearcase reporter jcl-motion jcl-safe-init
jcl-site-start jpt-mode erlang-start cal-iso qp cl-extra gnus-ml
cursor-sensor nndraft nnmh nnfolder nnml jcl-master jcl-calendar-init
jcl-emms-init emms-playlist-limit emms-volume emms-volume-amixer
emms-i18n emms-history emms-score emms-stream-info
emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon
emms-browser sort emms-playlist-sort emms-last-played emms-player-xine
emms-player-mpd tq emms-streams emms-show-all emms-tag-editor emms-mark
emms-cache emms-info-opusinfo emms-info-ogginfo emms-info-mp3info
emms-player-vlc emms-player-mpv emms-player-mplayer emms-librefm-stream
emms-librefm-scrobbler emms-playing-time emms-info later-do xml
jcl-gnus-init jcl-gnus jcl-org-import-icalendar jcl-status jcl-emms
emms-playlist-mode emms-source-playlist emms-mode-line emms-setup
emms-lyrics emms-url emms-source-file locate emms-player-simple emms
emms-compat jcl-buffer-init org-element avl-tree generator
org-location-google-maps org-agenda google-maps google-maps-static
google-maps-geocode google-maps-base json map org org-macro org-footnote
org-pcomplete pcomplete org-list org-faces org-entities org-version
ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs autorevert
filenotify appt jcl-calendar jcl-swedish-postfix quail help-mode
holidays hol-loaddefs icalendar diary-lib diary-loaddefs cal-menu
calendar cal-loaddefs dired-aux dired-x mm-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
gnus-topic w3m doc-view jka-compr image-mode timezone w3m-hist w3m-fb
bookmark-w3m w3m-ems w3m-favicon w3m-image w3m-proc w3m-util gnus-agent
gnus-srvr gnus-score score-mode nnvirtual nntp gnus-cache gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls
utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range gnus-win
mailcap starttls smtpmail sendmail message rmc puny format-spec rfc822
mml mml-sec epa derived epg mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils mm-util mail-prsvr
wid-edit jcl-boot jcl-slime-init slime-fancy slime-trace-dialog
slime-fontifying-fu slime-package-fu slime-references
slime-compiler-notes-tree slime-scratch slime-presentations bridge
slime-macrostep macrostep slime-mdot-fu slime-enclosing-context
slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc slime-repl slime-parse jcl-misc
jcl-ert picpocket jcl-windows jcl-buffer jcl-compile ldap whitespace
winner ido num3-mode ispell find-lisp ert find-func ewoc debug slime
compile etags xref project arc-mode archive-mode noutline outline
easy-mmode pp hyperspec thingatpt browse-url jcl-face hi-lock dired
dired-loaddefs mic-paren which-func imenu hl-line jcl-times-init fortune
jcl-early-init jcl-compat-init advice jcl-util subr-x jcl-times server
term disp-table comint ansi-color ehelp ring sh-script smie executable
jcl-load-path finder-inf tex-site eimp-autoloads ipython-autoloads cl
memory-usage-autoloads slime-autoloads info package easymenu epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib time-date mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors 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 composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray 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 threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting xwidget-internal move-toolbar
gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 2980948 292521)
 (symbols 48 104444 115)
 (miscs 40 9688 3466)
 (strings 32 532596 46887)
 (string-bytes 1 17835329)
 (vectors 16 163799)
 (vector-slots 8 3724944 353612)
 (floats 8 1586 1374)
 (intervals 56 259762 0)
 (buffers 992 206))





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

* bug#37174: 26.2; Stabilize tabulated-list reversed sort
  2019-08-24 14:27 bug#37174: 26.2; Stabilize tabulated-list reversed sort Johan Claesson
@ 2019-09-20 22:09 ` Lars Ingebrigtsen
  2019-09-22  9:26   ` Johan Claesson
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-20 22:09 UTC (permalink / raw)
  To: Johan Claesson; +Cc: 37174

Johan Claesson <johanclaesson@bredband.net> writes:

> Sorting with S multiple times in a tabulated-list buffer should be
> stable but will sometimes reorder entries with the same value.  When the
> sort order is reversed the function tabulated-list--get-sorter will
> transform the sort function to sort the other way around by negating.  I
> think this is what cause the needless reordering and that it should be
> changed something like the following:

[...]

>        (if (cdr tabulated-list-sort-key)
> -          (lambda (a b) (not (funcall sorter a b)))
> +          (lambda (a b) (funcall sorter b a))

That looks like the correct solution, so I've applied it to the trunk.

If I read the logs correctly, I think that cumulatively you've now had
the number of lines committed to Emacs that's allowed without signing
copyright assignment papers.  For future patches, would you be willing
to sign such paperwork?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#37174: 26.2; Stabilize tabulated-list reversed sort
  2019-09-20 22:09 ` Lars Ingebrigtsen
@ 2019-09-22  9:26   ` Johan Claesson
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Claesson @ 2019-09-22  9:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 37174




Hi Lars,

I am willing to sign myself but the company i work for also need to sign
and the last time i asked they refused.  If this will become a problem
in the future i might ask them again.

Regards,

/Johan




On Sat, Sep 21 2019, Lars Ingebrigtsen wrote:
> Johan Claesson <johanclaesson@bredband.net> writes:
>
>> Sorting with S multiple times in a tabulated-list buffer should be
>> stable but will sometimes reorder entries with the same value.  When the
>> sort order is reversed the function tabulated-list--get-sorter will
>> transform the sort function to sort the other way around by negating.  I
>> think this is what cause the needless reordering and that it should be
>> changed something like the following:
>
> [...]
>
>>        (if (cdr tabulated-list-sort-key)
>> -          (lambda (a b) (not (funcall sorter a b)))
>> +          (lambda (a b) (funcall sorter b a))
>
> That looks like the correct solution, so I've applied it to the trunk.
>
> If I read the logs correctly, I think that cumulatively you've now had
> the number of lines committed to Emacs that's allowed without signing
> copyright assignment papers.  For future patches, would you be willing
> to sign such paperwork?





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

end of thread, other threads:[~2019-09-22  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-24 14:27 bug#37174: 26.2; Stabilize tabulated-list reversed sort Johan Claesson
2019-09-20 22:09 ` Lars Ingebrigtsen
2019-09-22  9:26   ` Johan Claesson

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