Package: dictionary-el
Version: 1.10-2
Severity: normal
Tags: patch

Hi,

I like to customize the view-read-only variable in order to enable
view-mode for read-only files.  However, view-mode is also being
enabled for dictionary buffers which is probably unintended behaviour
since the default view-mode keybindings conflict with the default
dictionary-mode keybindings (for instance, when I press 's' in a
dictionary buffer, I get isearch-forward instead of
dictionary-search).

Reading the source code for dictionary-el, I noticed that it uses the
function toggle-read-only which, according to documentation, has been
rendered obsolete since Emacs 24.3.  Setting the buffer-local variable
buffer-read-only instead of calling the toggle-read-only function
solves the issue.

Here is a very simple patch:

diff --git a/dictionary.el b/dictionary.el
index a5885c3..9c77e8b 100755
--- a/dictionary.el
+++ b/dictionary.el
@@ -679,7 +679,7 @@ This function knows about the special meaning of quotes 
(\")"
 
 (defun dictionary-pre-buffer ()
   "These commands are executed at the begin of a new buffer"
-  (toggle-read-only 0)
+  (setq buffer-read-only nil)
   (erase-buffer)
   (if dictionary-create-buttons
       (progn
@@ -722,7 +722,7 @@ This function knows about the special meaning of quotes 
(\")"
   (goto-char dictionary-marker)
   
   (set-buffer-modified-p nil)
-  (toggle-read-only 1))
+  (setq buffer-read-only t))
 
 (defun dictionary-display-search-result (reply)
   "This function starts displaying the result starting with the `reply'."


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.8.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dictionary-el depends on:
ii  emacs25-lucid [emacsen]  25.1+1-3+b1
ii  emacsen-common           2.0.8

dictionary-el recommends no packages.

dictionary-el suggests no packages.

-- no debconf information

-- 
Hermógenes Oliveira

Reply via email to