]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/ztree/ztree-util.el
Fix some quoting problems in doc strings
[gnu-emacs-elpa] / packages / ztree / ztree-util.el
index 85df4446d6203e71975563c536ecd84035577543..9f458d6a1c9c106f882df44f53abbb4f84fa3bf4 100644 (file)
@@ -1,10 +1,10 @@
-;;; ztree-util.el --- Auxulary utilities for the ztree package -*- lexical-binding: t; -*-
+;;; ztree-util.el --- Auxiliary utilities for the ztree package -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2015  Free Software Foundation, Inc.
+;; Copyright (C) 2013-2016  Free Software Foundation, Inc.
 ;;
-;; Author: Alexey Veretennikov <alexey dot veretennikov at gmail dot com>
-;; 
-;; Created: 2013-11-1l
+;; Author: Alexey Veretennikov <alexey.veretennikov@gmail.com>
+;;
+;; Created: 2013-11-11
 ;;
 ;; Keywords: files tools
 ;; URL: https://github.com/fourier/ztree
@@ -44,7 +44,7 @@ Taken from http://www.emacswiki.org/emacs/ElispCookbook#toc39"
 
 
 (defun ztree-printable-string (string)
-  "Strip newline character from file names, like 'Icon\n.
+  "Strip newline character from file names, like `Icon\n'.
 Argument STRING string to process.'."
   (replace-regexp-in-string "\n" "" string))
 
@@ -65,68 +65,6 @@ Used since `car-safe' returns nil for atoms"
     (insert text)
     (put-text-property start (point) 'face face)))
 
-
-(defmacro ztree-defrecord (record-name record-fields)
-  "Create a record (structure) and getters/setters.
-
-Record is the following set of functions:
- - Record constructor with name \"RECORD-NAME\"-create and list of
-arguments which will be assigned to RECORD-FIELDS
- - Record getters with names \"record-name\"-\"field\" accepting one
-argument - the record; \"field\" is from \"record-fields\" symbols
- - Record setters with names \"record-name\"-set-\"field\" accepting two
-arguments - the record and the field value
-
-Example:
-\(ztree-defrecord person (name age))
-
-will be expanded to the following functions:
-
-\(defun person-create (name age) (...)
-\(defun person-name (record) (...)
-\(defun person-age (record) (...)
-\(defun person-set-name (record value) (...)
-\(defun person-set-age (record value) (...)
-
-To test expansion one can use GNU Emacs's pp library:
-\(require 'pp)
-\(pp-macroexpand-expression
- '(ztree-defrecord person (name age)))"
-  (let ((ctor-name (intern (concat (symbol-name record-name) "-create")))
-        (rec-var (make-symbol "record")))
-    `(progn
-       ;; constructor with the name "record-name-create"
-       ;; with arguments list "record-fields" expanded
-       (defun ,ctor-name (,@record-fields)
-         (let ((,rec-var))
-           ,@(mapcar #'(lambda (x)
-                         (list 'setq rec-var (list 'plist-put rec-var (list 'quote x) x)))
-                     record-fields)))
-       ;; getters with names "record-name-field" where the "field"
-       ;; is from record-fields
-       ,@(mapcar #'(lambda (x)
-                     (let ((getter-name (intern (concat (symbol-name record-name)
-                                                        "-"
-                                                        (symbol-name x)))))
-                       `(progn
-                          (defun ,getter-name (,rec-var)
-                            (plist-get ,rec-var ',x)
-                            ))))
-                 record-fields)
-       ;; setters wit names "record-name-set-field where the "field"
-       ;; is from record-fields
-       ;; arguments for setters: (record value)
-       ,@(mapcar #'(lambda (x)
-                     (let ((setter-name (intern (concat (symbol-name record-name)
-                                                        "-set-"
-                                                        (symbol-name x)))))
-                       `(progn
-                          (defun ,setter-name (,rec-var value)
-                            (setq ,rec-var (plist-put ,rec-var ',x value))
-                            ))))
-                 record-fields))))
-
-
 (provide 'ztree-util)
 
 ;;; ztree-util.el ends here