[literate] checkdoc and package-lint changes

This commit is contained in:
contrapunctus 2021-02-14 09:08:56 +05:30
parent 3cbf9c1f10
commit fbbfd1eeec
2 changed files with 41 additions and 31 deletions

View File

@ -1,13 +1,11 @@
;;; chronometrist.el --- A time tracker with a nice interface -*- lexical-binding: t; -*- ;;; chronometrist.el --- A time tracker with a nice interface -*- lexical-binding: t; -*-
;; Author: contrapunctus <xmpp:contrapunctus@jabber.fr> ;; Author: contrapunctus <xmpp:contrapunctus@jabber.fr>
;; Maintainer: contrapunctus <xmpp:contrapunctus@jabber.fr> ;; Maintainer: contrapunctus <xmpp:contrapunctus@jabber.fr>
;; Keywords: calendar ;; Keywords: calendar
;; Homepage: https://github.com/contrapunctus-1/chronometrist ;; Homepage: https://github.com/contrapunctus-1/chronometrist
;; Package-Requires: ((emacs "25.1") ;; Package-Requires: ((emacs "25.1") (dash "2.16.0") (seq "2.20") (ts "0.2"))
;; (dash "2.16.0")
;; (seq "2.20")
;; (ts "0.2"))
;; Version: 0.6.5 ;; Version: 0.6.5
;; This is free and unencumbered software released into the public domain. ;; This is free and unencumbered software released into the public domain.
@ -55,18 +53,19 @@
;; For information on usage and customization, see https://github.com/contrapunctus-1/chronometrist/blob/master/README.md ;; For information on usage and customization, see https://github.com/contrapunctus-1/chronometrist/blob/master/README.md
;;; Code: ;;; Code:
(require 'dash) (require 'dash)
(require 'ts) (require 'ts)
(require 'seq) (require 'cl-lib)
(require 'filenotify) (require 'seq)
(require 'cl-lib) (require 'filenotify)
(require 'subr-x) (require 'subr-x)
(require 'parse-time)
(eval-when-compile (eval-when-compile
(defvar chronometrist-mode-map) (defvar chronometrist-mode-map)
(require 'subr-x)) (require 'subr-x))
(defcustom chronometrist-sexp-pretty-print-function #'chronometrist-plist-pp (defcustom chronometrist-sexp-pretty-print-function #'chronometrist-plist-pp
"Function used to pretty print plists in `chronometrist-file'. "Function used to pretty print plists in `chronometrist-file'.
@ -228,6 +227,7 @@ Point is placed at the end of the space."
(- (point) (point-at-bol))) (- (point) (point-at-bol)))
(defun chronometrist-plist-pp-pair-p (cons) (defun chronometrist-plist-pp-pair-p (cons)
"Return non-nil if CONS is a pair, i.e. (CAR . CDR)."
(and (listp cons) (not (listp (cdr cons))))) (and (listp cons) (not (listp (cdr cons)))))
(defun chronometrist-plist-pp-alist-p (list) (defun chronometrist-plist-pp-alist-p (list)
@ -239,6 +239,7 @@ considers it an alist."
(cl-loop for elt in list thereis (chronometrist-plist-pp-pair-p elt)))) (cl-loop for elt in list thereis (chronometrist-plist-pp-pair-p elt))))
(defun chronometrist-plist-pp-plist-p (list) (defun chronometrist-plist-pp-plist-p (list)
"Return non-nil if LIST is a property list, i.e. (:KEYWORD VALUE ...)"
(while (consp list) (while (consp list)
(setq list (if (and (keywordp (car list)) (setq list (if (and (keywordp (car list))
(consp (cdr list))) (consp (cdr list)))

View File

@ -11,8 +11,17 @@ According to =benchmark= at the time of writing, =org-babel-tangle= takes about
1. When opening this file, Emacs may freeze at the prompt for file-local variable values; if so, C-g will quit the prompt, and permanently marking them as safe will make the freezing stop. 1. When opening this file, Emacs may freeze at the prompt for file-local variable values; if so, C-g will quit the prompt, and permanently marking them as safe will make the freezing stop.
2. [ ] I like =visual-fill-column-mode= for natural language, but I don't want it applied to code blocks. =polymode.el= may hold answers. 2. [ ] I like =visual-fill-column-mode= for natural language, but I don't want it applied to code blocks. =polymode.el= may hold answers.
3. [ ] Is there a cleaner tangling solution which is equally fast? 3. [ ] Is there a cleaner tangling solution which is equally fast?
** Commentary ** Library headers and commentary
This is displayed when the user clicks on the package's entry in =M-x list-packages=. Once, for sake of neatness, I made the value of =Package-Requires:= multiline -
#+BEGIN_SRC emacs-lisp :tangle no
;; Package-Requires: ((emacs "25.1")
;; (dash "2.16.0")
;; (seq "2.20")
;; (ts "0.2"))
#+END_SRC
But I discovered that if I do that, =package-lint= says - =error: Couldn't parse "Package-Requires" header: End of file during parsing=.
"Commentary" is displayed when the user clicks on the package's entry in =M-x list-packages=.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;;; chronometrist.el --- A time tracker with a nice interface -*- lexical-binding: t; -*- ;;; chronometrist.el --- A time tracker with a nice interface -*- lexical-binding: t; -*-
@ -20,10 +29,7 @@ This is displayed when the user clicks on the package's entry in =M-x list-packa
;; Maintainer: contrapunctus <xmpp:contrapunctus@jabber.fr> ;; Maintainer: contrapunctus <xmpp:contrapunctus@jabber.fr>
;; Keywords: calendar ;; Keywords: calendar
;; Homepage: https://github.com/contrapunctus-1/chronometrist ;; Homepage: https://github.com/contrapunctus-1/chronometrist
;; Package-Requires: ((emacs "25.1") ;; Package-Requires: ((emacs "25.1") (dash "2.16.0") (seq "2.20") (ts "0.2"))
;; (dash "2.16.0")
;; (seq "2.20")
;; (ts "0.2"))
;; Version: 0.6.5 ;; Version: 0.6.5
;; This is free and unencumbered software released into the public domain. ;; This is free and unencumbered software released into the public domain.
@ -75,18 +81,19 @@ This is displayed when the user clicks on the package's entry in =M-x list-packa
** Code ** Code
*** Dependencies *** Dependencies
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;;; Code: ;;; Code:
(require 'dash) (require 'dash)
(require 'ts) (require 'ts)
(require 'seq) (require 'cl-lib)
(require 'filenotify) (require 'seq)
(require 'cl-lib) (require 'filenotify)
(require 'subr-x) (require 'subr-x)
(require 'parse-time)
(eval-when-compile (eval-when-compile
(defvar chronometrist-mode-map) (defvar chronometrist-mode-map)
(require 'subr-x)) (require 'subr-x))
#+END_SRC #+END_SRC
*** Backend *** Backend
**** pretty-print-function :custom:variable: **** pretty-print-function :custom:variable:
@ -885,7 +892,7 @@ TS must be a ts struct (see `ts.el')."
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun chronometrist-iso-date->ts (date) (defun chronometrist-iso-date->ts (date)
"Return a ts struct (see `ts.el') representing DATE. "Return a ts struct (see `ts.el') representing DATE.
DATE should be an ISO-8601 date string (\"YYYY-MM-DD\")." DATE should be an ISO-8601 date string (\"YYYY-MM-DD\")."
(-let [(year month day) (mapcar #'string-to-number (-let [(year month day) (mapcar #'string-to-number
(split-string date "-"))] (split-string date "-"))]
(ts-update (ts-update
@ -2276,6 +2283,8 @@ If ARG is a numeric argument, go forward that many times."
** Provide ** Provide
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(provide 'chronometrist) (provide 'chronometrist)
;;; chronometrist.el ends here
#+END_SRC #+END_SRC
# Local Variables: # Local Variables: