all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Patch to remove minor modes in tutorial
@ 2006-06-24 14:09 Lennart Borgman
  2006-06-25 15:34 ` Richard Stallman
  0 siblings, 1 reply; 29+ messages in thread
From: Lennart Borgman @ 2006-06-24 14:09 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 231 bytes --]

Some while ago I complained that the tutorial did not work if some minor 
modes where enabled. Attached is a patch for that. (I am not sure if I 
have sent this before. I asked for help installing them, but I did not 
get that.)



[-- Attachment #2: patch-for-tutorial.diff --]
[-- Type: text/plain, Size: 3884 bytes --]

Index: lisp/help-fns.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/help-fns.el,v
retrieving revision 1.89
diff -u -r1.89 help-fns.el
--- lisp/help-fns.el	11 May 2006 11:10:45 -0000	1.89
+++ lisp/help-fns.el	16 Jun 2006 22:07:02 -0000
@@ -98,7 +98,86 @@
 	  (newline (- n (/ n 2)))))
       (goto-char (point-min))
       (setq buffer-undo-list nil)
-      (set-buffer-modified-p nil))))
+      (set-buffer-modified-p nil)))
+
+  ;; Check if minor modes may disturb
+  (let (minor-modes-on minor-modes unknown)
+    (dolist (m minor-mode-list)
+      (let ((fmode (or (get m :minor-mode-function) m)))
+      (when (and (boundp m) (symbol-value m)
+                 (fboundp fmode)
+                 (condition-case err
+                     (progn
+                       (unless
+                           (equal '(keymap)
+                                  (symbol-value
+                                   (read (concat (symbol-name m) "-map"))))
+                         t))
+                   (error nil)))
+        (add-to-list 'minor-modes m))))
+    (dolist (m minor-mode-alist)
+      (add-to-list 'minor-modes (car m)))
+    (dolist (m minor-modes)
+      (when (symbol-value m)
+        (add-to-list 'minor-modes-on m)))
+
+    ;; Default minor modes
+    (dolist (m '(auto-compression-mode
+                 blink-cursor-mode
+                 encoded-kbd-mode
+                 file-name-shadow-mode
+                 font-lock-mode
+                 global-font-lock-mode
+                 line-number-mode
+                 menu-bar-mode
+                 mouse-wheel-mode
+                 tool-bar-mode
+                 tooltip-mode
+                 unify-8859-on-encoding-mode
+                 utf-translate-cjk-mode))
+      (setq minor-modes-on (delete m minor-modes-on)))
+
+    ;; Special
+    (when cua-mode
+      (add-to-list 'minor-modes-on 'cua-mode))
+
+    (when minor-modes-on
+      (setq minor-modes-on (sort minor-modes-on 'string<))
+      (let (remove-minor
+            (modes-on (copy-seq minor-modes-on))
+            )
+        (with-temp-buffer
+          (insert "\nYou are using some minor modes (")
+          (dolist (m modes-on)
+            (insert (format "%s" (car modes-on)))
+            (setq modes-on (cdr modes-on))
+            (if (= 1 (length modes-on))
+                (insert " and ")
+              (when modes-on (insert ", "))))
+          (insert
+           ") which can possibly override global key bindings."
+           "  The behavior of Emacs with these modes may"
+           " not match what the tutorial teaches.\n\n"
+           "Do you want to disable these modes when you are in the tutorial?"
+           "(y-or-n)"
+           )
+          (fill-region (point-min) (point-max))
+          (let ((use-dialog-box nil))
+            (setq remove-minor
+                  (y-or-n-p (format "%s " (buffer-substring
+                                           (point-min)
+                                           (- (point-max) 8)))))))
+        (if remove-minor
+            (progn
+              (make-local-variable 'emulation-mode-map-alists)
+              (setq emulation-mode-map-alists nil)
+              (dolist (m minor-modes-on)
+                (make-local-variable m)
+                (set m nil))
+              (message "Removed those bindings for the tutorial only."))
+          (message
+           "Please note that the tutorial may not work with this choice.")
+          )))))
 
 \f
 ;; Functions
@@ -325,6 +404,8 @@
 		 "a Lisp macro")
 		((eq (car-safe def) 'autoload)
 		 (setq file-name (nth 1 def))
+		 (let ((loc (locate-library file-name)))
+                   (when loc (setq file-name loc)))
 		 (format "%s autoloaded %s"
 			 (if (commandp def) "an interactive" "an")
 			 (if (eq (nth 4 def) 'keymap) "keymap"

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2006-07-30 20:38 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-24 14:09 Patch to remove minor modes in tutorial Lennart Borgman
2006-06-25 15:34 ` Richard Stallman
2006-06-25 21:27   ` Lennart Borgman
2006-06-26 11:33     ` Richard Stallman
2006-06-26 13:48       ` Lennart Borgman
2006-06-26 16:31         ` Kevin Rodgers
2006-06-26 16:45           ` Lennart Borgman
2006-06-27 15:44             ` Kevin Rodgers
2006-06-27 16:41               ` Lennart Borgman
2006-06-28 17:25               ` Richard Stallman
2006-06-29  8:41                 ` Kim F. Storm
2006-06-29 12:07                   ` Mathias Dahl
2006-06-29 12:27                     ` David Kastrup
2006-06-30 11:06                       ` Richard Stallman
2006-06-29 17:57                   ` Richard Stallman
2006-07-01  0:38                     ` Lennart Borgman
2006-07-01 23:55                       ` Richard Stallman
2006-07-02  8:54                         ` Lennart Borgman
2006-07-02 22:30                           ` Richard Stallman
2006-07-07  0:01                             ` Lennart Borgman
2006-07-07 19:31                               ` Richard Stallman
2006-07-08  3:14                               ` Giorgos Keramidas
2006-07-08 20:57                               ` Richard Stallman
2006-07-09  8:44                                 ` Lennart Borgman
2006-07-17 16:12                                 ` Lennart Borgman
2006-07-17 17:32                                   ` Lennart Borgman
2006-07-24 14:42                                     ` Richard Stallman
2006-07-30 20:38                                       ` Lennart Borgman
2006-06-27 16:14         ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.