Fix move/state persistence, use switch-to-buffer for screen reader
- Use setq with plist-put everywhere to ensure state changes persist (quoted list literals may be read-only in some Emacs builds) - Replace pop-to-buffer with switch-to-buffer so the RPG buffer opens in the current window instead of a Doom popup — screen reader reads it as a normal buffer, not a completion overlay Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
56
alien-rpg.el
56
alien-rpg.el
@@ -818,9 +818,9 @@
|
||||
(setq alien-rpg-state-file file)
|
||||
;; Zpětná kompatibilita — doplnit chybějící klíče
|
||||
(unless (plist-member alien-rpg-state :conditions)
|
||||
(plist-put alien-rpg-state :conditions nil))
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :conditions nil)))
|
||||
(unless (plist-member alien-rpg-state :armor)
|
||||
(plist-put alien-rpg-state :armor nil))
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :armor nil)))
|
||||
(message "Načteno: %s" file))))
|
||||
|
||||
(defun alien-rpg--autosave ()
|
||||
@@ -897,7 +897,7 @@
|
||||
deck-ids ", "))))))
|
||||
(goto-char (point-min))
|
||||
(special-mode))
|
||||
(pop-to-buffer "*Alien RPG*")))
|
||||
(switch-to-buffer "*Alien RPG*")))
|
||||
|
||||
(defun alien-rpg-move ()
|
||||
"Přesun do propojené místnosti."
|
||||
@@ -911,7 +911,7 @@
|
||||
(format "%s -> " (plist-get room :id))
|
||||
candidates nil t))
|
||||
(target-id (cdr (assoc choice candidates))))
|
||||
(plist-put alien-rpg-state :current-room target-id)
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :current-room target-id))
|
||||
(alien-rpg--autosave)
|
||||
(alien-rpg-where-am-i)))
|
||||
|
||||
@@ -923,7 +923,7 @@
|
||||
alien-rpg-rooms))
|
||||
(choice (completing-read "Teleport: " candidates nil t))
|
||||
(target-id (cdr (assoc choice candidates))))
|
||||
(plist-put alien-rpg-state :current-room target-id)
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :current-room target-id))
|
||||
(alien-rpg--autosave)
|
||||
(alien-rpg-where-am-i)))
|
||||
|
||||
@@ -987,7 +987,7 @@
|
||||
deck-ids ", "))))))
|
||||
(goto-char (point-min))
|
||||
(special-mode))
|
||||
(pop-to-buffer "*Alien RPG*")))
|
||||
(switch-to-buffer "*Alien RPG*")))
|
||||
|
||||
(defun alien-rpg-find-path ()
|
||||
"Všechny nejkratší cesty do cíle."
|
||||
@@ -1028,7 +1028,7 @@
|
||||
(insert "Cesta nenalezena.\n")))
|
||||
(goto-char (point-min))
|
||||
(special-mode))
|
||||
(pop-to-buffer "*Alien RPG*")))
|
||||
(switch-to-buffer "*Alien RPG*")))
|
||||
|
||||
(defun alien-rpg-deck-overview ()
|
||||
"Přehled paluby."
|
||||
@@ -1053,7 +1053,7 @@
|
||||
(plist-get r :location)))))
|
||||
(goto-char (point-min))
|
||||
(special-mode))
|
||||
(pop-to-buffer "*Alien RPG*")))
|
||||
(switch-to-buffer "*Alien RPG*")))
|
||||
|
||||
(defun alien-rpg-station-overview ()
|
||||
"Přehled stanice."
|
||||
@@ -1074,7 +1074,7 @@
|
||||
("H" (insert " (průlezy G<->H)\n ---\n"))))))
|
||||
(goto-char (point-min))
|
||||
(special-mode))
|
||||
(pop-to-buffer "*Alien RPG*")))
|
||||
(switch-to-buffer "*Alien RPG*")))
|
||||
|
||||
(defun alien-rpg-key-locations ()
|
||||
"Klíčová místa."
|
||||
@@ -1100,7 +1100,7 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
||||
"))
|
||||
(goto-char (point-min))
|
||||
(special-mode))
|
||||
(pop-to-buffer "*Alien RPG*"))
|
||||
(switch-to-buffer "*Alien RPG*"))
|
||||
|
||||
(defun alien-rpg-status ()
|
||||
"Stav postavy — stručně."
|
||||
@@ -1159,7 +1159,7 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
||||
(or (plist-get alien-rpg-state :rival) "--"))))
|
||||
(goto-char (point-min))
|
||||
(special-mode))
|
||||
(pop-to-buffer "*Alien RPG*")))
|
||||
(switch-to-buffer "*Alien RPG*")))
|
||||
|
||||
(defun alien-rpg-skills ()
|
||||
"Dovednosti — seřazené od nejsilnějších."
|
||||
@@ -1191,37 +1191,37 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
||||
(insert (format "\nTalent: %s\n" (plist-get alien-rpg-character :talent))))
|
||||
(goto-char (point-min))
|
||||
(special-mode))
|
||||
(pop-to-buffer "*Alien RPG*")))
|
||||
(switch-to-buffer "*Alien RPG*")))
|
||||
|
||||
;; --- Upravy stavu ---
|
||||
|
||||
(defun alien-rpg-set-health (n)
|
||||
"Nastav Health."
|
||||
(interactive "nHealth (0-4): ")
|
||||
(plist-put alien-rpg-state :health (max 0 (min 4 n)))
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :health (max 0 (min 4 n))))
|
||||
(alien-rpg--autosave)
|
||||
(message "Health: %d/4" (plist-get alien-rpg-state :health)))
|
||||
|
||||
(defun alien-rpg-set-stress (n)
|
||||
"Nastav Stress."
|
||||
(interactive "nStress (0+): ")
|
||||
(plist-put alien-rpg-state :stress (max 0 n))
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :stress (max 0 n)))
|
||||
(alien-rpg--autosave)
|
||||
(message "Stress: %d" (plist-get alien-rpg-state :stress)))
|
||||
|
||||
(defun alien-rpg-add-injury (injury)
|
||||
"Přidej zranění."
|
||||
(interactive "sZranění: ")
|
||||
(plist-put alien-rpg-state :injuries
|
||||
(append (plist-get alien-rpg-state :injuries) (list injury)))
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :injuries
|
||||
(append (plist-get alien-rpg-state :injuries) (list injury))))
|
||||
(alien-rpg--autosave)
|
||||
(message "Zranění: %s" injury))
|
||||
|
||||
(defun alien-rpg-add-gear (item)
|
||||
"Přidej výbavu."
|
||||
(interactive "sVýbava: ")
|
||||
(plist-put alien-rpg-state :extra-gear
|
||||
(append (plist-get alien-rpg-state :extra-gear) (list item)))
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :extra-gear
|
||||
(append (plist-get alien-rpg-state :extra-gear) (list item))))
|
||||
(alien-rpg--autosave)
|
||||
(message "Výbava: %s" item))
|
||||
|
||||
@@ -1236,8 +1236,8 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
||||
(weight (read-number "Weight: " 1))
|
||||
(weapon (list :name name :bonus bonus :damage damage
|
||||
:range range :ammo ammo :weight weight)))
|
||||
(plist-put alien-rpg-state :weapons
|
||||
(append (plist-get alien-rpg-state :weapons) (list weapon)))
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :weapons
|
||||
(append (plist-get alien-rpg-state :weapons) (list weapon))))
|
||||
(alien-rpg--autosave)
|
||||
(message "Zbraň: %s +%d/DMG%d/%s" name bonus damage range)))
|
||||
|
||||
@@ -1248,7 +1248,7 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
||||
(rating (read-number "Rating: " 1))
|
||||
(weight (read-number "Weight: " 1))
|
||||
(armor (list :name name :rating rating :weight weight)))
|
||||
(plist-put alien-rpg-state :armor armor)
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :armor armor))
|
||||
(alien-rpg--autosave)
|
||||
(message "Brnění: %s (%d/W%d)" name rating weight)))
|
||||
|
||||
@@ -1256,31 +1256,31 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
||||
"Přidej stav (Fatigued, Radiation, ...)."
|
||||
(interactive)
|
||||
(let ((cond-name (read-string "Stav: ")))
|
||||
(plist-put alien-rpg-state :conditions
|
||||
(append (plist-get alien-rpg-state :conditions) (list cond-name)))
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :conditions
|
||||
(append (plist-get alien-rpg-state :conditions) (list cond-name))))
|
||||
(alien-rpg--autosave)
|
||||
(message "Stav: %s" cond-name)))
|
||||
|
||||
(defun alien-rpg-set-buddy (name)
|
||||
"Nastav Buddy."
|
||||
(interactive "sBuddy: ")
|
||||
(plist-put alien-rpg-state :buddy name)
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :buddy name))
|
||||
(alien-rpg--autosave)
|
||||
(message "Buddy: %s" name))
|
||||
|
||||
(defun alien-rpg-set-rival (name)
|
||||
"Nastav Rivala."
|
||||
(interactive "sRival: ")
|
||||
(plist-put alien-rpg-state :rival name)
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :rival name))
|
||||
(alien-rpg--autosave)
|
||||
(message "Rival: %s" name))
|
||||
|
||||
(defun alien-rpg-add-note (note)
|
||||
"Přidej poznámku."
|
||||
(interactive "sPoznamka: ")
|
||||
(plist-put alien-rpg-state :notes
|
||||
(setq alien-rpg-state (plist-put alien-rpg-state :notes
|
||||
(append (plist-get alien-rpg-state :notes)
|
||||
(list (format "[%s] %s" (format-time-string "%H:%M") note))))
|
||||
(list (format "[%s] %s" (format-time-string "%H:%M") note)))))
|
||||
(alien-rpg--autosave)
|
||||
(message "Poznámka uložena."))
|
||||
|
||||
@@ -1296,7 +1296,7 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
||||
(insert "(žádné poznámky)\n")))
|
||||
(goto-char (point-min))
|
||||
(special-mode))
|
||||
(pop-to-buffer "*Alien RPG*"))
|
||||
(switch-to-buffer "*Alien RPG*"))
|
||||
|
||||
;; ====================================================================
|
||||
;; DOOM EMACS KEYBINDINGS
|
||||
|
||||
Reference in New Issue
Block a user