Changeset - ec2a94810d3b
[Not reviewed]
0 2 0
Sergey Pashinin - 12 years ago 2014-03-11 21:53:12
sergey@pashinin.com
Hints to test workgroup parameters set/get
2 files changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/workgroups-functions.el
Show inline comments
 
@@ -640,25 +640,29 @@ in BODY."
 
  "Return a workgroup from OBJ.
 
If OBJ is a workgroup, return it.
 
If OBJ is a string, return the workgroup named OBJ, or error unless NOERROR.
 
If OBJ is nil, return the current workgroup, or error unless NOERROR."
 
  (cond ((wg-workgroup-p obj) obj)
 
        ((stringp obj) (wg-find-workgroup-by :name obj noerror))
 
        ((null obj) (wg-current-workgroup noerror))
 
        (t (error "Can't get workgroup from type:: %S" (type-of obj)))))
 

	
 

	
 

	
 
;;; workgroup parameters
 

	
 
;;
 
;; Quick test:
 
;; (wg-workgroup-parameters (wg-current-workgroup))
 
;; (wg-set-workgroup-parameter (wg-current-workgroup) 'test1 t)
 
;; (wg-workgroup-parameter (wg-current-workgroup) 'test1)
 
(defun wg-workgroup-parameter (workgroup parameter &optional default)
 
  "Return WORKGROUP's value for PARAMETER.
 
If PARAMETER is not found, return DEFAULT which defaults to nil.
 
WORKGROUP should be accepted by `wg-get-workgroup'."
 
  (wg-aget (wg-workgroup-parameters (wg-get-workgroup workgroup))
 
           parameter default))
 

	
 
(defun wg-set-workgroup-parameter (workgroup parameter value)
 
  "Set WORKGROUP's value of PARAMETER to VALUE.
 
WORKGROUP should be a value accepted by `wg-get-workgroup'.
 
Return VALUE."
 
  (let ((workgroup (wg-get-workgroup workgroup)))
src/workgroups-structs.el
Show inline comments
 
@@ -3,24 +3,25 @@
 
;;
 
;; Copyright (C) Sergey Pashinin
 
;; Author: Sergey Pashinin <sergey@pashinin.com>
 
;;
 
;; `wg-defstruct'
 
;;
 
;; It creates some functions named like "wg-buf-...", "wg-session-..."
 
;;
 
;; To get a value you can use:
 
;; (wg-session-... (wg-current-session))
 
;; Like:
 
;; (wg-session-file-name (wg-current-session))
 
;; (wg-workgroup-parameters (wg-current-workgroup))
 
;;
 
;; To set a value (in `wg-write-session-file'):
 
;;
 
;; (setf (wg-session-file-name (wg-current-session)) filename)
 
;;
 
;;; Code:
 

	
 
(require 'workgroups-utils-basic)
 

	
 
(wg-defstruct wg buf
 
  (uid (wg-generate-uid))
 
  (name)
0 comments (0 inline, 0 general)