[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 11/39: Initial Checkin
From: |
Phillip Lord |
Subject: |
[elpa] 11/39: Initial Checkin |
Date: |
Mon, 20 Oct 2014 08:22:34 +0000 |
phillord pushed a commit to branch externals/pabbrev
in repository elpa.
commit 1efce25f5f2929a16c9dfa7c2699a625c0c44207
Author: Phillip Lord <address@hidden>
Date: Thu Oct 25 12:01:11 2012 +0100
Initial Checkin
---
paredit-menu.el | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 123 insertions(+), 0 deletions(-)
diff --git a/paredit-menu.el b/paredit-menu.el
new file mode 100644
index 0000000..ffd8fc3
--- /dev/null
+++ b/paredit-menu.el
@@ -0,0 +1,123 @@
+;;; paredit-menu.el --- Adds a menu to paredit.el as memory aid
+
+;; This file is not part of Emacs
+
+;; Author: Phillip Lord <address@hidden>
+;; Maintainer: Phillip Lord <address@hidden>
+;; Keywords: paredit
+
+;; COPYRIGHT NOTICE
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+;;
+;; Paredit mode provides structured editing for Lisp. It achieves this by
+;; ensuring that code is always well-formed while editing. While it is very
+;; helpful, sometimes it leaves the less experienced user (such as the myself)
+;; scratching their head over how to achieve a simple editing task.
+
+;; One solution is to use the cheatsheet
+;; (http://emacswiki.org/emacs/PareditCheatsheet). However, this is outside
+;; Emacs and does not scale well. This file provides a second solution, which
+;; is a menu. While slower than using the equivalent key-presses, it provides
+;; an easy mechanism to look up the relevant commands. Tooltips are also
+;; provided showing the examples of use.
+
+;; Documentation and examples come directly from paredit, so the menu should
+;; automatically stay in sync, regardless of changes to paredit.
+
+;;; Installation:
+;;
+;; Add (require 'paredit-menu) to your .emacs. This will also force loading of
+;; paredit. If you autoload paredit, then
+;;
+;; (eval-after-load "paredit.el"
+;; '(require 'paredit-menu))
+;;
+;; will achieve the same effect.
+
+
+(require 'paredit)
+
+;;; Code:
+
+(defun paredit-menu-build-menu ()
+ "Builds the menu from `paredit-commands'."
+ (cons "Paredit"
+ (paredit-menu-build-menu-1 paredit-commands nil nil)))
+
+(defun paredit-menu-build-menu-1 (commands menu submenu)
+ "Really builds the menu.
+
+COMMANDS is the list of commands remaining to add
+MENU is the current menu
+SUBMENU is the current submenu"
+ (let ((first (car commands))
+ (rest (cdr commands)))
+ ;; drop last submenu in place and complete
+ (if (not first)
+ (append menu (list submenu))
+ ;; is a submenu title
+ (if (stringp first)
+ ;; start a new submenu
+ (paredit-menu-build-menu-1
+ rest
+ ;; appuending the last submenu if it exists
+ (if submenu
+ (append menu (list submenu))
+ menu)
+ (list first))
+ ;; we have a command
+ (paredit-menu-build-menu-1
+ rest menu
+ (append submenu
+ (list (vector (paredit-menu-symbol-name
+ (symbol-name (nth 1 first)))
+ (nth 1 first)
+ :help (paredit-menu-help-string first)))))))))
+
+
+(defun paredit-menu-symbol-name (name)
+ "Generate display name from symbol name.
+
+No point putting \"paredit\" on the front of everything, so chop
+this off.
+
+NAME is the symbol name."
+(substring name 8))
+
+(defun paredit-menu-help-string (command)
+ "Generate help string for command.
+
+COMMAND is the command"
+ (let ((string
+ (mapconcat
+ (lambda (x)
+ (format "%s -> \n\t%s" (nth 0 x) (nth 1 x))
+ )
+ (cddr command) "\n\n")))
+ (if (eq "" string)
+ "No Example"
+ string)))
+
+
+(easy-menu-define menubar-paredit paredit-mode-map "paredit"
+ (paredit-menu-build-menu))
+
+(provide 'paredit-menu)
+
+;;; paredit-menu.el ends here
- [elpa] branch externals/pabbrev created (now e0ac26a), Phillip Lord, 2014/10/20
- [elpa] 04/39: Updated commentary, Phillip Lord, 2014/10/20
- [elpa] 07/39: Added support $$ pass through, which works with an unconfigured asciidoc., Phillip Lord, 2014/10/20
- [elpa] 03/39: Removed SVN keywords, Phillip Lord, 2014/10/20
- [elpa] 10/39: Removed local hook as it's is long obsolete., Phillip Lord, 2014/10/20
- [elpa] 08/39: Minor code tweaks., Phillip Lord, 2014/10/20
- [elpa] 09/39: Added slime mode to excluded modes, Phillip Lord, 2014/10/20
- [elpa] 06/39: Prepared for Marmalade, Phillip Lord, 2014/10/20
- [elpa] 11/39: Initial Checkin,
Phillip Lord <=
- [elpa] 12/39: Initial Checkin, Phillip Lord, 2014/10/20
- [elpa] 16/39: Clojure mode support added., Phillip Lord, 2014/10/20
- [elpa] 15/39: Documentation Updates., Phillip Lord, 2014/10/20
- [elpa] 13/39: Initial Checkin, Phillip Lord, 2014/10/20
- [elpa] 17/39: Version number added. Documentation fix. Indentation fix., Phillip Lord, 2014/10/20
- [elpa] 05/39: Ported from generic.el to define-derived-mode. Comment-character is now "#" rather than fudged "# " Delimited URIs now recognised as strings Electric indentation added. Indentation engine improved., Phillip Lord, 2014/10/20
- [elpa] 20/39: New keywords added., Phillip Lord, 2014/10/20
- [elpa] 18/39: Copes better with missing repos. Improved output., Phillip Lord, 2014/10/20
- [elpa] 19/39: Markdown support added., Phillip Lord, 2014/10/20
- [elpa] 21/39: Exclude nrepl mode., Phillip Lord, 2014/10/20