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

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

Re: Keymap problem


From: address@hidden
Subject: Re: Keymap problem
Date: Mon, 16 Jul 2007 19:58:35 +0900
User-agent: Thunderbird 2.0.0.4 (X11/20070615)

I updated the lisp code to use pmd and added a pmd menu.
The keymap works well too now.

PMD scans Java source code and looks for potential problems like:

  • Possible bugs - empty try/catch/finally/switch statements
  • Dead code - unused local variables, parameters and private methods
  • Suboptimal code - wasteful String/StringBuffer usage
  • Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
  • Duplicate code - copied/pasted code means copied/pasted bugs
;;Begin PMD
(add-to-list 'load-path (expand-file-name (concat plugin_path "/pmd-emacs-0.6")))
(autoload 'pmd-current-buffer "pmd" "PMD Mode" t)
(autoload 'pmd-current-dir "pmd" "PMD Mode" t)
(setq pmd-home (expand-file-name (concat plugin_path "/pmd-emacs-0.6/pmd-3.9")))
(setq pmd-java-home "java")
(require 'easymenu)
(defvar pmd-minor-mode nil
  "")
(make-variable-buffer-local 'pmd-minor-mode)
;(put 'pmd-minor-mode 'permanent-local t)

(setq pmd-list-entry-keymap (make-keymap))
(use-local-map pmd-list-entry-keymap)
(defvar pmd:map nil
  "The pmd keymap.")
(setq pmd:map (make-sparse-keymap))
(define-key pmd:map "\C-cpb" 'pmd-current-buffer)
(define-key pmd:map "\C-cpd" 'pmd-current-dir)
(easy-menu-define pmd:menu
  (list pmd:map pmd-list-entry-keymap)
  "pmd menu"
  '("Pmd"
    [ "pmd current buffer" pmd-current-buffer t ]
    [ "pmd current dir" pmd-current-dir t ]
    ))

(or (assq 'pmd-minor-mode minor-mode-map-alist)
    (setq minor-mode-map-alist (cons (cons 'pmd-minor-mode pmd:map)
                     minor-mode-map-alist)))

(defun pmd-minor-mode (&optional arg)
  ""
  (progn
    (setq pmd-minor-mode (if (null arg) t (car arg)))
    (if pmd-minor-mode
    (progn
      (easy-menu-add pmd:menu pmd:map)
          ))
    pmd-minor-mode     
    )
  )
(add-hook 'jde-mode-hook (function pmd-minor-mode))
;;End pmd


lu@luxdo.jp wrote:
I use the following code to define a menu named "Pmd" which
have only one menu item named "pmd current buffer".
The menuitem binded to 'pmd-current-buffer.
but the shotcut (C-c p b) does not work,What is the problem?
Thanks.

(defun pmd-minor-mode (&optional arg)
""
(setq pmd-list-entry-keymap (make-keymap))
(use-local-map pmd-list-entry-keymap)
(defvar pmd:map nil
"The pmd keymap.")
(setq pmd:map (make-sparse-keymap))
(define-key pmd:map "\C-cpb" 'pmd-current-buffer)
(easy-menu-define pmd:menu
(list pmd:map pmd-list-entry-keymap)
"pmd menu"
'("Pmd"
[ "pmd current buffer" pmd-current-buffer t ]
)
)

(easy-menu-add pmd:menu pmd:map)
)

(add-hook 'jde-mode-hook (function pmd-minor-mode))



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

  


reply via email to

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