+;;; notes-aux.el --- Auxiliary functions for notes-mode and friends
-;;;
-;;; notes-aux.el
-;;; auxiliary functions for notes-mode and friends
-;;; $Id: notes-aux.el,v 1.10 2000/03/24 21:36:33 johnh Exp $
-;;;
-;;; Copyright (C) 1994,1995,1998 by John Heidemann
-;;; Comments to <johnh@isi.edu>.
-;;;
-;;; This file is under the Gnu Public License, version 2.
-;;;
+;; Copyright (C) 1994,1995,1998,2012 Free Software Foundation, Inc.
-\f
-;;;
-;;; generic-{beginning,end}-of-defun
-;;; I use in tex-mode and notes-mode
-;;;
+;; Author: <johnh@isi.edu>.
-;;;###autoload
-(defun generic-beginning-of-defun (regexp)
- "* Go to the beginning of defun identified by REGEXP."
- (re-search-backward regexp 0 'to-limit)
-)
-
-;;;###autoload
-(defun generic-end-of-defun (regexp)
- "* Go to the end of defun identified by REGEXP."
- (let
- ((restore-point (point)))
- (if (looking-at regexp)
- (goto-char (match-end 0)))
- ;; find next section and leave cursor at section beginning
- (if (re-search-forward regexp (point-max) 'to-limit)
- (re-search-backward regexp 0 t)
- ;(goto-char restore-point)
- ))
-)
+;; This file is part of GNU Emacs.
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
-;;;###autoload
-(defun match-substring (string count &optional default empty-default)
- "Given STRING, return the COUNT-th element from the last match.
-Returns DEFAULT if there is no such match,
-or if the match is empty and EMPTY-DEFAULT is non-nil."
- (if (and (match-beginning count)
- (or (not empty-default)
- (> (match-end count) (match-beginning count))))
- (substring string (match-beginning count) (match-end count))
- default))
-
-\f
-;;;
-;;; get-{beginning,end}-of-line
-;;; Simple functions for a simple world.
-;;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
-;;;###autoload
-(defun get-beginning-of-line ()
- "Return the boln as a position."
- (save-excursion
- (beginning-of-line)
- (point)))
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-;;;###autoload
-(defun get-end-of-line ()
- "Return the boln as a position."
- (save-excursion
- (end-of-line)
- (point)))
+;;; Commentary:
+;;; Code:
;;;###autoload
-;(defun notes-format-date (&optional calendar-date)
-; "Format the calendar-date-style DATE up to be a notes-format date.
-;If no DATE is specified, use today's date."
-; (require 'calendar)
-; (let* ((date (if calendar-date
-; calendar-date
-; (calendar-current-date)))
-; (month (car date))
-; (day (nth 1 date))
-; (year (nth 2 date)))
-; (format "%02d%02d%02d" (- year 1900) month day)))
+;;(defun notes-format-date (&optional calendar-date)
+;; "Format the calendar-date-style DATE up to be a notes-format date.
+;;If no DATE is specified, use today's date."
+;; (require 'calendar)
+;; (let* ((date (if calendar-date
+;; calendar-date
+;; (calendar-current-date)))
+;; (month (car date))
+;; (day (nth 1 date))
+;; (year (nth 2 date)))
+;; (format "%02d%02d%02d" (- year 1900) month day)))
(defun notes-format-date (&optional time)
"Format the TIME up to be a notes-format date.
If no TIME is specified, use today's date."
(format-time-string notes-file-form time))
(defun notes-file-to-epoch (file)
- "* Convert a notes FILE to an epoch time."
+ "Convert a notes FILE to an epoch time."
(string-match notes-file-regexp file)
(let
- ((y (string-to-int (substring file (match-beginning 1) (match-end 1))))
- (m (string-to-int (substring file (match-beginning 2) (match-end 2))))
- (d (string-to-int (substring file (match-beginning 3) (match-end 3)))))
+ ((y (string-to-number (match-string 1 file)))
+ (m (string-to-number (match-string 2 file)))
+ (d (string-to-number (match-string 3 file))))
(if (< y 1900)
(setq y (+ y 1900)))
(if (< y 1970)
(encode-time 0 0 12 d m y)))
(defun notes-file-to-url (file &optional tag)
- "* Convert a notes FILE to a URL with an optional TAG."
+ "Convert a notes FILE to a URL with an optional TAG."
(let
((epoch (notes-file-to-epoch file)))
(concat
tag)))
(provide 'notes-aux)
+;;; notes-aux.el ends here