all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Peder O. Klingenberg" <peder@klingenberg.no>
To: 72185@debbugs.gnu.org
Subject: bug#72185: 31.0.50; Indicate most recent score in game high score tables
Date: Thu, 18 Jul 2024 22:55:51 +0200	[thread overview]
Message-ID: <87bk2uzag8.fsf@klingenberg.no> (raw)

[-- Attachment #1: Type: text/plain, Size: 11552 bytes --]


In this age of pointless zoom calls, I would go crazy without M-x tetris
or M-x snake to pass the time.  Because I'm a sad old bastard with no
friends, I mean because I have the computational power of what used to
be a supercomputer for my sole use, I have the high scores stored in my
user directory, not shared, and the usernames are identical for all
fifty entries.

I'm competitive, and would like to see how I did when a game ends, but
that means manually scanning the list to find the most recent date, or
if the game window is still visible, the line matching my score.

It would be a slight improvement if the point in the buffer displaying
the score file moved to the most recently added score.

Attached is a patch to accomplish this.


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2024-07-17 built on PedersHP
Repository revision: 3a790abd869ddadc343710deb0c4368227ba6611
Repository branch: master
Windowing system distributor 'HC-Consult', version 11.0.12009000
System Description: Ubuntu 20.04.6 LTS

Configured using:
 'configure --with-x-toolkit=lucid --with-native-compilation
 --with-tree-sitter --with-small-ja-dic --prefix=/usr/local/emacs-git
 CC=gcc-10'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM
LUCID ZLIB

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  display-line-numbers-mode: t
  smartparens-strict-mode: t
  smartparens-mode: t
  which-key-mode: t
  marginalia-mode: t
  csv-field-index-mode: t
  sly-symbol-completion-mode: t
  pyvenv-mode: t
  beacon-mode: t
  global-git-gutter-mode: t
  git-gutter-mode: t
  bug-reference-prog-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  server-mode: t
  global-corfu-mode: t
  corfu-mode: t
  override-global-mode: t
  vertico-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/pok/.emacs.d/elpa/emacsql-sqlite-20240623.1340/emacsql-sqlite hides /home/pok/.emacs.d/elpa/emacsql-20240714.1824/emacsql-sqlite
/home/pok/.emacs.d/elpa/bind-key-20230203.2004/bind-key hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/bind-key
/home/pok/.emacs.d/elpa/transient-20240713.2102/transient hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/transient
/home/pok/.emacs.d/elpa/which-key-20240620.2145/which-key hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/which-key
/home/pok/.emacs.d/elpa/use-package-20230426.2324/use-package hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/use-package/use-package
/home/pok/.emacs.d/elpa/use-package-20230426.2324/use-package-diminish hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/use-package/use-package-diminish
/home/pok/.emacs.d/elpa/use-package-20230426.2324/use-package-core hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/use-package/use-package-core
/home/pok/.emacs.d/elpa/use-package-20230426.2324/use-package-jump hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/use-package/use-package-jump
/home/pok/.emacs.d/elpa/use-package-20230426.2324/use-package-lint hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/use-package/use-package-lint
/home/pok/.emacs.d/elpa/use-package-20230426.2324/use-package-delight hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/use-package/use-package-delight
/home/pok/.emacs.d/elpa/use-package-20230426.2324/use-package-ensure hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/use-package/use-package-ensure
/home/pok/.emacs.d/elpa/use-package-20230426.2324/use-package-bind-key hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/use-package/use-package-bind-key
/home/pok/.emacs.d/elpa/eglot-20220726.1405/eglot hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/progmodes/eglot
/home/pok/.emacs.d/elpa/csharp-mode-20221126.2005/csharp-mode hides /usr/local/emacs-git/share/emacs/31.0.50/lisp/progmodes/csharp-mode

Features:
(shadow footnote ecomplete mail-extr emacsbug magit-patch magit-subtree
magit-gitignore magit-ediff ediff ediff-merg ediff-mult ediff-wind
ediff-diff ediff-help ediff-init ediff-util goto-addr rect ispell
vc-annotate log-view magit-extras emacsql-sqlite-builtin sqlite
whitespace misearch multi-isearch mule-util display-line-numbers
smartparens-config smartparens-org smartparens-python
smartparens-markdown smartparens-text smartparens-c smartparens loadhist
wheatgrass-theme which-key marginalia php-mode mode-local consult-imenu
consult-yasnippet consult speedbar ezimage dframe cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align php-face php php-project
projectile lisp-mnt cc-engine cc-vars cc-defs csv-mode sort multi-vterm
vterm magit-bookmark bookmark tramp trampver tramp-integration
tramp-message tramp-compat xdg tramp-loaddefs face-remap term disp-table
ehelp vterm-module term/xterm xterm restclient sly sly-completion
sly-buttons sly-messages sly-common apropos arc-mode archive-mode
hyperspec gradle-mode groovy-mode debbugs soap-client rng-xsd rng-dt
rng-util xsd-regexp xml virtualenvwrapper gud highlight-indentation
flymake company-capf company-jedi jedi-core python-environment epc
ctable concurrent deferred company help-fns radix-tree elpy elpy-rpc
pyvenv eshell esh-cmd esh-ext esh-proc esh-opt esh-io esh-arg esh-module
esh-module-loaddefs esh-util elpy-shell elpy-profile elpy-django s
elpy-refactor ido hideshow etags fileloop generator xref
markdown-preview-eww yasnippet easy-kill ace-window avy beacon
git-timemachine vc-git git-gutter forge-repos forge-tablist hl-line
forge-topics forge-commands forge-semi forge-bitbucket buck forge-gogs
gogs forge-gitea gtea forge-gitlab glab forge-github ghub-graphql treepy
gsexp ghub url-http url-gw nsm url-auth let-alist gnutls forge-notify
forge-revnote forge-pullreq forge-issue forge-topic yaml parse-time
iso8601 eieio-custom bug-reference forge-post markdown-mode color
forge-repo forge forge-core forge-db closql emacsql-sqlite-common
emacsql emacsql-compiler eieio-base magit-submodule 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 which-func imenu magit-diff smerge-mode diff
diff-mode track-changes git-commit log-edit message sendmail yank-media
puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068
epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert
autorevert filenotify magit-margin magit-transient magit-process
with-editor server magit-mode benchmark magit-git magit-base
magit-section cursor-sensor crm dash exec-path-from-shell try
xterm-color ob-python python project ob-lisp ob-perl ob-shell shell
org-tempo tempo rg files-x vc vc-dispatcher rg-info-hack advice rg-menu
transient rg-ibuffer rg-result wgrep-rg wgrep rg-history rg-header
ibuf-ext ibuffer ibuffer-loaddefs grep compile text-property-search
cus-edit pp cus-load wid-edit orderless corfu edmacro kmacro
use-package-bind-key bind-key easy-mmode vertico compat savehist comp
comp-cstr cl-extra help-mode warnings comp-run comp-common org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script smie
treesit executable ob-comint org-pcomplete pcomplete comint ansi-osc
ansi-color ring org-list org-footnote org-faces org-entities time-date
noutline outline ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx
org-fold org-fold-core org-keys oc org-loaddefs thingatpt find-func
cal-menu calendar cal-loaddefs org-version org-compat org-macs
format-spec use-package-ensure use-package-core finder-inf
bbdb-autoloads beacon-autoloads consult-eglot-autoloads
consult-yasnippet-autoloads corfu-autoloads csv-mode-autoloads
debbugs-autoloads easy-kill-autoloads eglot-autoloads elpy-autoloads
company-autoloads emacsql-sqlite-autoloads embark-consult-autoloads
consult-autoloads embark-autoloads exec-path-from-shell-autoloads
forge-autoloads closql-autoloads ghub-autoloads git-gutter-autoloads
git-timemachine-autoloads groovy-mode-autoloads concurrent-autoloads
marginalia-autoloads markdown-mode-autoloads multi-vterm-autoloads
f-autoloads csharp-mode-autoloads auto-complete-autoloads
flycheck-autoloads orderless-autoloads org-roam-autoloads
emacsql-autoloads ox-hugo-autoloads php-mode-autoloads popup-autoloads
restclient-autoloads rg-autoloads sly-autoloads smartparens-autoloads
tomelr-autoloads treemacs-icons-dired-autoloads treemacs-magit-autoloads
magit-autoloads pcase magit-section-autoloads git-commit-autoloads
transient-autoloads treemacs-projectile-autoloads treemacs-autoloads
posframe-autoloads ht-autoloads hydra-autoloads pfuture-autoloads
ace-window-autoloads avy-autoloads projectile-autoloads treepy-autoloads
use-package-autoloads bind-key-autoloads vertico-autoloads s-autoloads
dash-autoloads vterm-autoloads wgrep-autoloads which-key-autoloads info
with-editor-autoloads xterm-color-autoloads yaml-autoloads
yaml-mode-autoloads yasnippet-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs icons password-cache json
subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 838068 144361) (symbols 48 52485 4)
 (strings 32 241377 10064) (string-bytes 1 7996317) (vectors 16 92598)
 (vector-slots 8 1099473 173070) (floats 8 561 2440)
 (intervals 56 6905 2129) (buffers 992 26))

...Peder...
-- 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Visualize-ranking-of-last-game-when-adding-scores.patch --]
[-- Type: text/x-diff, Size: 2656 bytes --]

From 3dd4aee83dfbdf44babecd8ad19f059779026eeb Mon Sep 17 00:00:00 2001
From: "Peder O. Klingenberg" <peder@klingenberg.no>
Date: Thu, 18 Jul 2024 22:34:54 +0200
Subject: [PATCH] Visualize ranking of last game when adding scores

* lisp/play/gamegrid.el (gamegrid-add-score-insecure): Move point
to the score just added, or end of buffer if the new score did not
make the list.  Makes it easier to see where the last game ranked.
---
 lisp/play/gamegrid.el | 46 +++++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el
index a098d0f6f69..0089404d87a 100644
--- a/lisp/play/gamegrid.el
+++ b/lisp/play/gamegrid.el
@@ -639,27 +639,31 @@ gamegrid-add-score-with-update-game-score-1
 
 (defun gamegrid-add-score-insecure (file score &optional directory reverse)
   (save-excursion
-    (setq file (expand-file-name file (or directory
-					  temporary-file-directory)))
-    (unless (file-exists-p (file-name-directory file))
-      (make-directory (file-name-directory file) t))
-    (find-file-other-window file)
-    (setq buffer-read-only nil)
-    (goto-char (point-max))
-    (insert (format "%05d\t%s\t%s <%s>\n"
-		    score
-		    (current-time-string)
-		    (user-full-name)
-		    user-mail-address))
-    (sort-fields 1 (point-min) (point-max))
-    (unless reverse
-      (reverse-region (point-min) (point-max)))
-    (goto-char (point-min))
-    (forward-line gamegrid-score-file-length)
-    (delete-region (point) (point-max))
-    (setq buffer-read-only t)
-    (save-buffer)
-    (view-mode)))
+    (let ((score-line (format "%05d\t%s\t%s <%s>\n"
+		              score
+		              (current-time-string)
+		              (user-full-name)
+		              user-mail-address)))
+      (setq file (expand-file-name file (or directory
+					    temporary-file-directory)))
+      (unless (file-exists-p (file-name-directory file))
+        (make-directory (file-name-directory file) t))
+      (find-file-other-window file)
+      (setq buffer-read-only nil)
+      (goto-char (point-max))
+      (insert score-line)
+      (sort-fields 1 (point-min) (point-max))
+      (unless reverse
+        (reverse-region (point-min) (point-max)))
+      (goto-char (point-min))
+      (forward-line gamegrid-score-file-length)
+      (delete-region (point) (point-max))
+      (setq buffer-read-only t)
+      (save-buffer)
+      (view-mode)
+      (goto-char (point-min))
+      (when (search-forward score-line nil 'end)
+        (forward-line -1)))))
 
 
 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-- 
2.25.1


             reply	other threads:[~2024-07-18 20:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 20:55 Peder O. Klingenberg [this message]
2024-07-19 17:14 ` bug#72185: 31.0.50; Indicate most recent score in game high score tables Stefan Kangas
2024-07-21  3:02 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bk2uzag8.fsf@klingenberg.no \
    --to=peder@klingenberg.no \
    --cc=72185@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.