diff options
| author | Stefan Monnier <monnier@iro.umontreal.ca> | 2026-05-01 14:45:36 -0400 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2026-05-01 15:14:55 -0400 |
| commit | 88ae406e1e52caa55b11c7c0ed97e7ae689308c0 (patch) | |
| tree | 0c94095b362173bcddee8b7879a660cd65628f76 | |
| parent | a18efe343cf3842c1696de7ad2a424ec48febab3 (diff) | |
po-mode: Put the NNt+MMo annotations next to the mode namescratch/po-mode
That's a lot easier to do and doesn't break down as badly when faced
with a custom `mode-line-format`. Also the old code forgot to add
a separation after the "NNt+MMo", which made it "bump" into the
subsequent "NN%/Top/Bot" indicator (at least in my config), resulting
in confusion.
* po-mode.el (po-mode-flag): Delete var.
(po-mode): Put `po-mode-line-string` directly in the mode-name.
(po-mode-line-entry): Delete var and delete the code that tries to place it
into `mode-line-format`.
| -rw-r--r-- | po-mode.el | 22 |
1 files changed, 1 insertions, 21 deletions
@@ -500,9 +500,6 @@ The current buffer should be in PO mode, when this function is called." ;; byte compiler warnings. It also introduces some documentation for ;; each of these variables, all meant to be local to PO mode buffers. -(defvar-local po-mode-flag nil - "Flag telling that `po-mode-line-string' should be displayed.") - ;; PO buffers are kept read-only to prevent random modifications. READ-ONLY ;; holds the value of the read-only flag before PO mode was entered. (defvar po-read-only) @@ -928,7 +925,7 @@ M-S Ignore path M-A Ignore PO file *M-L Ignore lexicon (easy-menu-define po-mode-menu po-mode-map "" po-mode-menu-layout) ;;;###autoload -(define-derived-mode po-mode nil "PO" +(define-derived-mode po-mode nil '("PO[" po-mode-line-string "]") "Major mode for translators when they edit PO files. Behaviour may be adjusted through some variables, @@ -938,8 +935,6 @@ all reachable through `M-x customize', in group `Emacs.Editing.I18n.Po'." (set (make-local-variable 'po-read-only) buffer-read-only) (setq buffer-read-only t) - (setq po-mode-flag t) - (po-check-file-header) (po-compute-counters nil) @@ -984,21 +979,6 @@ all reachable through `M-x customize', in group `Emacs.Editing.I18n.Po'." ;;; Window management. -;; FIXME: Instead of this po-mode-flag business added to the mode-line -;; why not (setq mode-name '("PO[" po-mode-line-string "]"))? - -(defvar po-mode-line-entry '(po-mode-flag (" " po-mode-line-string)) - "Mode line format entry displaying MODE-LINE-STRING.") - -;; Insert MODE-LINE-ENTRY in mode line, but on first load only. -(or (member po-mode-line-entry mode-line-format) - ;; mode-line-format usually contains global-mode-string, but some - ;; people customize this variable. As a last resort, append at the end. - (let ((prev-entry (or (member 'global-mode-string mode-line-format) - (member " " mode-line-format) - (last mode-line-format)))) - (setcdr prev-entry (cons po-mode-line-entry (cdr prev-entry))))) - (defun po-update-mode-line-string () "Compute a new statistics string to display in mode line." (setq po-mode-line-string |
