Changeset - fbcee4c7e066
[Not reviewed]
0 2 0
Sergey Pashinin - 11 years ago 2014-08-23 12:53:03
sergey@pashinin.com
Moved wg-fill-keymap
2 files changed with 7 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/workgroups-keys.el
Show inline comments
 
@@ -7,24 +7,31 @@
 
(require 'workgroups-utils-basic)
 

	
 
(defcustom wg-prefix-key (kbd "C-c z")
 
  "Workgroups' prefix key.
 
Setting this variable requires that `workgroups-mode' be turned
 
off and then on again to take effect."
 
  :type 'string
 
  :group 'workgroups)
 

	
 
(defvar workgroups-mode-map nil
 
  "Workgroups Mode's keymap.")
 

	
 
(defun wg-fill-keymap (keymap &rest binds)
 
  "Return KEYMAP after defining in it all keybindings in BINDS."
 
  (while binds
 
    (define-key keymap (car binds) (cadr binds))
 
    (setq binds (cddr binds)))
 
  keymap)
 

	
 
(defvar wg-prefixed-map
 
  (wg-fill-keymap
 
   (make-sparse-keymap)
 

	
 
   ;; workgroups
 
   (kbd "C-c")        'wg-create-workgroup
 
   (kbd "c")          'wg-create-workgroup
 
   (kbd "C")          'wg-clone-workgroup
 
   (kbd "A")          'wg-rename-workgroup
 
   (kbd "C-'")        'wg-switch-to-workgroup
 
   (kbd "'")          'wg-switch-to-workgroup
 
   (kbd "C-v")        'wg-switch-to-workgroup
src/workgroups-utils-basic.el
Show inline comments
 
@@ -436,40 +436,30 @@ The car of each element of SLOT-BINDINGS is the bound symbol, and
 
the cadr as the accessor function."
 
  (declare (indent 2))
 
  (wg-with-gensyms (objsym)
 
    `(let* ((,objsym ,obj)
 
            ,@(wg-docar (slot slot-bindings)
 
                `(,(car slot) (,(cadr slot) ,objsym))))
 
       ,@body)))
 

	
 

	
 

	
 
;;; misc
 

	
 

	
 
(defun wg-fill-keymap (keymap &rest binds)
 
  "Return KEYMAP after defining in it all keybindings in BINDS."
 
  (while binds
 
    (define-key keymap (car binds) (cadr binds))
 
    (setq binds (cddr binds)))
 
  keymap)
 

	
 
(defun wg-add-or-remove-hooks (remove &rest pairs)
 
  "Add FUNCTION to or remove it from HOOK, depending on REMOVE."
 
  (dolist (pair (wg-partition pairs 2))
 
    (funcall (if remove 'remove-hook 'add-hook)
 
             (car pair) (cadr pair))))
 

	
 

	
 

	
 
(defmacro wg-set-parameter (place parameter value)
 
  "Set PARAMETER to VALUE at PLACE.
 
This needs to be a macro to allow specification of a setf'able place."
 
  (wg-with-gensyms (p v)
 
    `(let ((,p ,parameter) (,v ,value))
 
       (wg-pickelable-or-error ,p)
 
       (wg-pickelable-or-error ,v)
 
       (setf ,place (wg-aput ,place ,p ,v))
 
       ,v)))
 

	
 

	
 
;;; uid utils
0 comments (0 inline, 0 general)