bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#11127: 24.0.94; [PATCH] Tutorial breaks with modified key bindings


From: Aaron S. Hawley
Subject: bug#11127: 24.0.94; [PATCH] Tutorial breaks with modified key bindings
Date: Thu, 29 Mar 2012 14:49:33 -0400

2012-03-29  Aaron S. Hawley  <aaron.s.hawley@gmail.com>

        * tutorial.el (help-with-tutorial, tutorial--display-changes): If
        user has modified default key bindings then Emacs complains
        "Buffer is read-only: #<buffer TUTORIAL>" rather than adding the
        notice about "the most important standard Emacs commands".

--- tutorial.el 2012-02-13 11:13:25.000000000 -0500
+++ tutorial.el 2012-03-29 14:25:01.667926700 -0400
@@ -538,7 +538,8 @@
 If some of the default key bindings that the tutorial depends on
 have been changed then display the changes in the tutorial buffer
 with some explanatory links."
-  (let* ((changed-keys (tutorial--find-changed-keys
+  (let* ((inhibit-read-only t)
+         (changed-keys (tutorial--find-changed-keys
                        tutorial--default-keys))
         ;; Alist of element (DESC . CK) where DESC is the
         ;; key-description of a changed key and CK is the
@@ -828,7 +829,7 @@
           (setq old-tut-file
                 (y-or-n-p "Resume your last saved tutorial? ")))
         (if old-tut-file
-            (progn
+            (let ((inhibit-read-only t))
               (insert-file-contents (tutorial--saved-file))
              (let ((enable-local-variables :safe))
                (hack-local-variables))
@@ -846,7 +847,8 @@
               (delete-region (point-min) (point))
               (goto-char tutorial--point-before-chkeys)
               (setq tutorial--point-before-chkeys (point-marker)))
-          (insert-file-contents (expand-file-name filename tutorial-directory))
+          (let ((inhibit-read-only t))
+            (insert-file-contents (expand-file-name filename
tutorial-directory)))
          (let ((enable-local-variables :safe))
            (hack-local-variables))
           (forward-line)
@@ -871,12 +873,14 @@
           ;; Delete the arch-tag line, so as not to confuse readers.
           (goto-char (point-max))
           (if (search-backward ";;; arch-tag: " nil t)
-              (delete-region (point) (point-max)))
+              (let ((inhibit-read-only t))
+                (delete-region (point) (point-max))))
           (goto-char (point-min))
           (search-forward "\n<<")
           (beginning-of-line)
           ;; Convert the <<...>> line to the proper [...] line,
           ;; or just delete the <<...>> line if a [...] line follows.
+          (let ((inhibit-read-only t))
           (cond ((save-excursion
                    (forward-line 1)
                    (looking-at "\\["))
@@ -887,18 +891,19 @@
                  (looking-at "<<")
                  (replace-match "[")
                  (search-forward ">>")
-                 (replace-match "]")))
+                 (replace-match "]"))))
           (beginning-of-line)
           ;; FIXME: if the window is not tall, and especially if the
           ;; big red "NOTICE: The main purpose..." text has been
           ;; inserted at the start of the buffer, the "type C-v to
           ;; move to the next screen" might not be visible on the
           ;; first screen (n < 0).  How will the novice know what to do?
-          (let ((n (- (window-height (selected-window))
+          (let ((inhibit-read-only t)
+                (n (- (window-height (selected-window))
                       (count-lines (point-min) (point))
                       6)))
             (if (< n 8)
-                (progn
+                (let ((inhibit-read-only t))
                   ;; For a short gap, we don't need the [...] line,
                   ;; so delete it.
                   (delete-region (point) (progn (end-of-line) (point)))

Thanks for Emacs,
aaron

-- 
In general, we reserve the right to have a poor
memory--the computer, however, is supposed to
remember!  Poor computer.  -- Guy Lewis Steele Jr.





reply via email to

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