[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug#287261: gettext-el: bad interaction with view-read-only (fwd)

From: Santiago Vila
Subject: Bug#287261: gettext-el: bad interaction with view-read-only (fwd)
Date: Tue, 11 Jan 2005 17:50:25 +0100 (CET)


Received this from the Debian bug system.
[ Please Cc: the submitter and address@hidden ].

---------- Forwarded message ----------
From: Kalle Olavi Niemitalo <address@hidden>
To: Debian Bug Tracking System <address@hidden>
Date: Sun, 26 Dec 2004 15:57:51 +0200
Subject: Bug#287261: gettext-el: bad interaction with view-read-only

Package: gettext-el
Version: 0.14.1-5
Severity: minor
File: /usr/share/emacs/site-lisp/gettext/po-mode.el
Tags: patch

I have customized `view-read-only' to t, which generally results 
in useful behavior.  Now however, when I visit a *.po file, 
`after-find-file' calls `normal-mode', which calls `po-mode', 
which sets `buffer-read-only' to t, and `after-find-file' then 
enables View mode, which shadows the key bindings of PO mode: for 
example, RET scrolls the buffer rather than opens a translation 
for editing.  I then have to explicitly disable View mode before 
I can edit the translations.

I believe the right way to solve the problem is to add this form 
somewhere near (defun po-mode ...) in po-mode.el:

  (put 'po-mode 'mode-class 'special)

Then `after-find-file' will abstain from enabling View mode, even 
though the buffer is read only.  According to the Emacs Lisp 
Reference Manual, the setting will also affect two other aspects 
of PO mode:

- When the current buffer is in PO mode and `default-major-mode' 
is nil, visiting a new file (not listed in `auto-mode-alist') 
will not make the new buffer inherit PO mode from the current 

- Items specific to editing will not appear in the tool bar in PO 

I believe these effects are not harmful.

diff -u /usr/share/emacs/site-lisp/gettext/po-mode.el 
--- /usr/share/emacs/site-lisp/gettext/po-mode.el       2004-07-27 
00:21:24.000000000 +0300
+++ /home/kalle/share/emacs/site-lisp/po-mode.el        2004-12-26 
15:45:38.000000000 +0200
@@ -48,6 +48,11 @@
 ;; You may also adjust some variables, below, by defining them in your
 ;; '.emacs' file, either directly or through command 'M-x customize'.
+;;; Change Log:
+;; 2004-12-26  Kalle Olavi Niemitalo  <address@hidden>
+;;     (po-mode): Mark the major mode as special.
 ;;; Code:
 (defconst po-mode-version-string "2.01" "\
@@ -1015,6 +1020,10 @@
   "Keymap for PO mode.")
+;; PO mode makes the buffer read only but should not enable View mode
+;; even when `view-read-only' is t.
+(put 'po-mode 'mode-class 'special)
 (defun po-mode ()
   "Major mode for translators when they edit PO files.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]