Changeset - 061700c825b7
[Not reviewed]
0 4 0
Sergey Pashinin - 12 years ago 2014-02-26 00:10:50
sergey@pashinin.com
More fixes to cl-functions
4 files changed with 11 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/workgroups-functions.el
Show inline comments
 
@@ -428,13 +428,13 @@ BUFFER or `wg-default-buffer' is visible in the only window."
 
                          top
 
                          (+ left (funcall width-fn  (- right  left)))
 
                          (+ top  (funcall height-fn (- bottom top))))))))
 

	
 
(defun wg-scale-w-size (w width-scale height-scale)
 
  "Scale W's size by WIDTH-SCALE and HEIGHT-SCALE."
 
  (cl-flet
 
  (cl-labels
 
      ((wscale (width)  (truncate (* width  width-scale)))
 
       (hscale (height) (truncate (* height height-scale))))
 
    (wg-adjust-w-size w #'wscale #'hscale)))
 

	
 
(defun wg-equal-wtrees (w1 w2)
 
  "Return t when W1 and W2 have equal structure."
 
@@ -552,15 +552,15 @@ Otherwise, reverse WTREE vertically."
 
  wconfig)
 

	
 
(defun wg-flatten-wtree (wtree &optional key)
 
  "Return a new list by flattening WTREE.
 
KEY non returns returns a list of WTREE's wins.
 
KEY non-nil returns a list of the results of calling KEY on each win."
 
  (cl-flet
 
  (cl-labels
 
      ((inner (w) (if (wg-win-p w) (list (if key (funcall key w) w))
 
                    (cl-mapcan 'inner (wg-wtree-wlist w)))))
 
                    (cl-mapcan #'inner (wg-wtree-wlist w)))))
 
    (inner wtree)))
 

	
 
(defun wg-win-list (wtree)
 
  "Construct and return a list of all wg-wins in WTREE."
 
  (wg-flatten-wtree wtree))
 

	
src/workgroups-pickel.el
Show inline comments
 
@@ -339,40 +339,40 @@
 
  (defun wg-pickel-workgroup-parameters (workgroup)
 
    "If WORKGROUP's parameters are non-nil, return a copy of
 
WORKGROUP after pickeling its parameters. Otherwise return
 
WORKGROUP."
 
    (if (not (wg-workgroup-parameters workgroup)) workgroup
 
      (let ((copy (wg-copy-workgroup workgroup)))
 
        (wg-asetf (wg-workgroup-parameters copy) (wg-pickel copy))
 
        (wg-asetf (wg-workgroup-parameters copy) (wg-pickel it))
 
        copy)))
 

	
 
  (defun wg-unpickel-workgroup-parameters (workgroup)
 
    "If WORKGROUP's parameters are non-nil, return a copy of
 
WORKGROUP after unpickeling its parameters. Otherwise return
 
WORKGROUP."
 
    (if (not (wg-workgroup-parameters workgroup)) workgroup
 
      (let ((copy (wg-copy-workgroup workgroup)))
 
        (wg-asetf (wg-workgroup-parameters copy) (wg-unpickel copy))
 
        (wg-asetf (wg-workgroup-parameters copy) (wg-unpickel it))
 
        copy)))
 

	
 
  (defun wg-pickel-all-session-parameters (session)
 
    "Return a copy of SESSION after pickeling its
 
parameters and the parameters of all its workgroups."
 
    (let ((copy (wg-copy-session session)))
 
      (when (wg-session-parameters copy)
 
        (wg-asetf (wg-session-parameters copy) (wg-pickel copy)))
 
        (wg-asetf (wg-session-parameters copy) (wg-pickel it)))
 
      (wg-asetf (wg-session-workgroup-list copy)
 
                (cl-mapcar 'wg-pickel-workgroup-parameters it))
 
      copy))
 

	
 
  (defun wg-unpickel-session-parameters (session)
 
    "Return a copy of SESSION after unpickeling its
 
parameters and the parameters of all its workgroups."
 
    (let ((copy (wg-copy-session session)))
 
      (when (wg-session-parameters copy)
 
        (wg-asetf (wg-session-parameters copy) (wg-unpickel copy)))
 
        (wg-asetf (wg-session-parameters copy) (wg-unpickel it)))
 
      (wg-asetf (wg-session-workgroup-list copy)
 
                (cl-mapcar 'wg-unpickel-workgroup-parameters it))
 
      copy))
 

	
 
(provide 'workgroups-pickel)
 
;;; workgroups-pickel.el ends here
src/workgroups-specialbufs.el
Show inline comments
 
@@ -109,13 +109,13 @@ You can get these commands using `wg-get-org-agenda-view-commands'."
 
(wg-support 'term-mode 'term
 
            `((serialize . ,(lambda (buffer)
 
                              (if (get-buffer-process buffer)
 
                                  (wg-last1 (process-command (get-buffer-process buffer)))
 
                                "/bin/bash")))
 
              (deserialize . ,(lambda (buffer vars)
 
                                (cl-flet ((term-window-width () 80)
 
                                (cl-labels ((term-window-width () 80)
 
                                            (window-height () 24))
 
                                  (prog1 (term vars)
 
                                    (rename-buffer (wg-buf-name buffer) t)))))))
 

	
 
;; Python
 
(wg-support 'inferior-python-mode 'python
src/workgroups-utils-basic.el
Show inline comments
 
@@ -219,13 +219,13 @@ Cribbed from `org-id-b36-to-int-one-digit'."
 
        ((and (>= i ?A) (<= i ?Z)) (+ (- i ?A) 10))
 
        (t (error "Invalid b36 character"))))
 

	
 
(defun wg-int-to-b36 (i &optional length)
 
  "Return a base 36 string from I."
 
  (let ((base 36) b36)
 
    (cl-flet ((add-digit () (push (wg-int-to-b36-one-digit (mod i base)) b36)
 
    (cl-labels ((add-digit () (push (wg-int-to-b36-one-digit (mod i base)) b36)
 
                         (setq i (/ i base))))
 
      (add-digit)
 
      (while (> i 0) (add-digit))
 
      (setq b36 (cl-map 'string 'identity b36))
 
      (if (not length) b36
 
        (concat (make-string (max 0 (- length (length b36))) ?0) b36)))))
 
@@ -511,13 +511,13 @@ N defaults to 1, and FRAME defaults to `selected-frame'."
 
  "`defstruct' wrapper that namespace-prefixes all generated functions.
 
Note: this doesn't yet work with :conc-name, and possibly other
 
options."
 
  (declare (indent 2))
 
  (let* ((name (if (consp name-form) (car name-form) name-form))
 
         (prefixed-name (wg-symcat prefix "-" name)))
 
    (cl-flet ((rebind (opstr)
 
    (cl-labels ((rebind (opstr)
 
                      (let ((oldfnsym (wg-symcat opstr "-" prefix "-" name)))
 
                        `((fset ',(wg-symcat prefix "-" opstr "-" name)
 
                                (symbol-function ',oldfnsym))
 
                          (fmakunbound ',oldfnsym)))))
 
      ;; `eval-and-compile' gets rid of byte-comp warnings ("function `foo' not
 
      ;; known to be defined").  We can accomplish this with `declare-function'
 
@@ -569,13 +569,13 @@ the cadr as the accessor function."
 

	
 

	
 
(defun wg-read-object (prompt test warning &optional initial-contents keymap
 
                              read hist default-value inherit-input-method)
 
  "PROMPT for an object that satisfies TEST, WARNING if necessary.
 
ARGS are `read-from-minibuffer's args, after PROMPT."
 
  (cl-flet ((read () (read-from-minibuffer
 
  (cl-labels ((read () (read-from-minibuffer
 
                      prompt initial-contents keymap read hist
 
                      default-value inherit-input-method)))
 
    (let ((obj (read)))
 
      (when (and (equal obj "") default-value) (setq obj default-value))
 
      (while (not (funcall test obj))
 
        (message warning)
0 comments (0 inline, 0 general)