[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string-map arg order
From: |
Thien-Thi Nguyen |
Subject: |
Re: string-map arg order |
Date: |
Fri, 24 Aug 2001 15:36:19 -0700 |
From: Alex Shinn <address@hidden>
Date: 23 Aug 2001 17:36:43 -0400
But silly me, I forgot to check string-for-each, which is also using
the wrong order! Patches attached, including string-for-each-index
which had not been implemented.
thanks! patches applied.
in the future, could you include entries suitable for cvs change log?
(don't worry about formatting them for ChangeLog use, we'll take care of
that.) i've appended some elisp that you can use to make things
slightly easier...
also, in order to accept more significant contributions, we need to
arrange for the proper paperwork to be filed w/ fsf, assuming this has
not already been done.
thi
_______________________________________________
;;; patch.el --- mail/apply a patch
;; Copyright (C) 2001 Free Software Foundation, Inc.
;; 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 2, or (at your option)
;; any later version.
;; 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.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Author: Thien-Thi Nguyen <address@hidden>
;;; Version: 1
;;; Favorite-Favorite: Favorite-Favorite
;;; Commentary:
;; This file has two symmetrical usage modes, for patch creation and
;; application, respectively. The details are somewhat tuned for Guile
;; maintenance; probably we should generalize it a bit and add it to
;; Emacs proper at some point in the future. Long live free software!
;;
;; On the patch creation side of things, there are various version
;; control systems that are happy to write a diff to stdout (and
;; numerous Emacs interfaces to them all). Thus, we provide only a
;; simple `patch-submit' that composes mail from the current buffer;
;; the contents of that buffer are left as an exercise for the patch
;; creator. When preparing the mail, `patch-submit' scans the patch
;; for standard filename headers and sets up a skeleton change log --
;; filling this in is a good way to earn respect from maintainers (hint
;; hint). Type `C-c C-c' to send the mail when you are done. (See
;; `compose-mail' for more info.)
;;
;; TODO: Write/document patch-apply side of things.
;; TODO: Integrate w/ `ediff-patch-buffer' et al.
;;; Code:
(require 'cl)
(defvar patch-greeting "hello guile maintainers,\n\n"
"*String to insert at beginning of patch mail.")
(defun patch-scan-files ()
(let (files)
(save-excursion
(while (re-search-forward "^[+][+][+] \\(\\S-+\\)" (point-max) t)
(setq files (cons (cons (match-string 1)
(match-beginning 0))
files))))
(reverse files)))
(defun patch-common-prefix (filenames)
(let* ((first-file (car filenames))
(prefix (and first-file (file-name-directory first-file))))
(while (and prefix
(not (string= "" prefix))
(not (every (lambda (filename)
(string-match (concat "^" prefix) filename))
filenames)))
(setq prefix (file-name-directory (substring prefix 0 -1))))
prefix))
(defun patch-changelog-skeleton ()
(let* ((file-info (patch-scan-files))
(fullpath-files (mapcar 'car file-info))
(cut (length (patch-common-prefix fullpath-files)))
(files (mapcar (lambda (fullpath-file)
(substring fullpath-file cut))
fullpath-files)))
(mapconcat
(lambda (file)
(concat (make-string (length file) ?_) "\n" file "\n[writeme]"))
files
"\n")))
(defun patch-submit (buffer subject)
(interactive "bBuffer: \nsSubject: ")
(when (string= "" subject)
(error "(empty subject)"))
(compose-mail "address@hidden" subject)
(insert (with-current-buffer buffer (buffer-string)))
(mail-text)
(insert patch-greeting)
(save-excursion
(insert "here is a patch ... [overview/observations/etc]\n\n"
(patch-changelog-skeleton) "\n\n\n"
(make-string 72 ?_) "\n")))
;;; patch.el ends here
- string-map arg order, Alex Shinn, 2001/08/21
- Re: string-map arg order, Mikael Djurfeldt, 2001/08/22
- Re: string-map arg order, Martin Grabmueller, 2001/08/23
- Re: string-map arg order, Thien-Thi Nguyen, 2001/08/23
- Re: string-map arg order, Thien-Thi Nguyen, 2001/08/23
- Re: string-map arg order, Alex Shinn, 2001/08/23
- Re: string-map arg order,
Thien-Thi Nguyen <=
- Message not available
- Re: string-map arg order, Thien-Thi Nguyen, 2001/08/29
- Re: string-map arg order, Marius Vollmer, 2001/08/29
- Re: string-map arg order, Alex Shinn, 2001/08/29
- Re: string-map arg order, Alex Shinn, 2001/08/30
- Re: string-map arg order, Thien-Thi Nguyen, 2001/08/30