unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Fringe in Show/Hide menu?
@ 2002-04-01 17:19 Pavel Janík
  2002-04-02  6:00 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Pavel Janík @ 2002-04-01 17:19 UTC (permalink / raw)


Hi,

I'd like to see the possibility of turning on/off fringes in Show/Hide
submenu of Options menu. Here is my current code:

2002-04-01  Pavel Janík  <Pavel@Janik.cz>

	* menu-bar.el (menu-bar-showhide-menu): Rename menu items.
	(menu-bar-showhide-fringe-menu): New sub-menu.
	(toggle-fringe): New function.
	(menu-bar-showhide-fringe-menu): New menu-items.

There is one problem - I do not see an easy way of saving this to .emacs
via customize. Do you have an idea?

--- menu-bar.el.~1.205.~	Sun Mar 31 11:12:18 2002
+++ menu-bar.el	Mon Apr  1 18:13:12 2002
@@ -616,7 +616,7 @@
     (message "Display-time mode disabled.")))
 
 (define-key menu-bar-showhide-menu [showhide-date-time]
-  '(menu-item "Date and time" (lambda ()
+  '(menu-item "Date and Time" (lambda ()
 				(interactive)
 				(showhide-date-time)
 				(customize-mark-as-set 'display-time-mode))
@@ -635,6 +635,49 @@
 			      (frame-visible-p 
 			       (symbol-value 'speedbar-frame))))))
 
+(defvar menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe"))
+
+(defun toggle-fringe (&optional arg)
+  "Toggle fringes on/off.
+ARG can be one of 'left-fringe or 'right-fringe.
+When called interactively, both fringes are toggled"
+  (interactive)
+  (if (null arg)
+      (progn
+	(toggle-fringe 'left-fringe)
+	(toggle-fringe 'right-fringe))
+    (modify-frame-parameters
+     (selected-frame)
+     (list (cons arg
+		 (if (< 0 (cdr (assq arg
+				     (frame-parameters))))
+		     0 nil))))))
+
+(define-key menu-bar-showhide-fringe-menu [right]
+  '(menu-item "On the Right" 
+	      (lambda ()
+		(interactive)
+		(toggle-fringe 'right-fringe))
+	      :help "Turn fringe on the right on/off"
+	      :visible window-system
+	      :button (:toggle . (< 0 (cdr (assq 'right-fringe
+						 (frame-parameters)))))))
+
+(define-key menu-bar-showhide-fringe-menu [left]
+  '(menu-item "On the Left" 
+	      (lambda ()
+		(interactive)
+		(toggle-fringe 'left-fringe))
+	      :help "Turn fringe on the left on/off"
+	      :visible window-system
+	      :button (:toggle . (< 0 (cdr (assq 'left-fringe
+						 (frame-parameters)))))))
+
+(define-key menu-bar-showhide-menu [showhide-fringe]
+  (list 'menu-item "Fringe" menu-bar-showhide-fringe-menu
+	:visible 'window-system
+	:help "Select fringe mode"))
+
 (defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar"))
 
 (define-key menu-bar-showhide-scroll-bar-menu [right]
@@ -668,7 +711,7 @@
 					       (frame-parameters))) nil))))
 
 (define-key menu-bar-showhide-menu [showhide-scroll-bar]
-  (list 'menu-item "Scroll-Bar" menu-bar-showhide-scroll-bar-menu
+  (list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu
 	:visible 'window-system
 	:help "Select scroll-bar mode"))
 

-- 
Pavel Janík

Congratulations. You have been brainwashed by Dan Bernstein.
                  -- Linus Torvalds in linux-kernel

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

end of thread, other threads:[~2002-04-06 10:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-01 17:19 Fringe in Show/Hide menu? Pavel Janík
2002-04-02  6:00 ` Eli Zaretskii
2002-04-02 12:04 ` Per Abrahamsen
2002-04-02 16:50   ` Pavel Janík
2002-04-04 15:45     ` Per Abrahamsen
2002-04-02 18:27 ` Richard Stallman
2002-04-02 21:52   ` Kim F. Storm
2002-04-02 22:05     ` Stefan Monnier
2002-04-06 10:01     ` Pavel Janík

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).