1 ;;; notes-aux.el --- Auxiliary functions for notes-mode and friends
3 ;; Copyright (C) 1994,1995,1998,2012 Free Software Foundation, Inc.
5 ;; Author: <johnh@isi.edu>.
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;;(defun notes-format-date (&optional calendar-date)
28 ;; "Format the calendar-date-style DATE up to be a notes-format date.
29 ;;If no DATE is specified, use today's date."
30 ;; (require 'calendar)
31 ;; (let* ((date (if calendar-date
33 ;; (calendar-current-date)))
36 ;; (year (nth 2 date)))
37 ;; (format "%02d%02d%02d" (- year 1900) month day)))
38 (defun notes-format-date (&optional time)
39 "Format the TIME up to be a notes-format date.
40 If no TIME is specified, use today's date."
41 (require 'notes-variables)
43 (setq time (current-time)))
44 (format-time-string notes-file-form time))
46 (defun notes-file-to-epoch (file)
47 "Convert a notes FILE to an epoch time."
48 (string-match notes-file-regexp file)
50 ((y (string-to-number (match-string 1 file)))
51 (m (string-to-number (match-string 2 file)))
52 (d (string-to-number (match-string 3 file))))
57 (encode-time 0 0 12 d m y)))
59 (defun notes-file-to-url (file &optional tag)
60 "Convert a notes FILE to a URL with an optional TAG."
62 ((epoch (notes-file-to-epoch file)))
65 (format-time-string notes-int-form epoch)
67 (format-time-string notes-file-form epoch)
72 ;;; notes-aux.el ends here