1 new commit in text-modes:
https://bitbucket.org/xemacs/text-modes/commits/44d80d9f256d/
Changeset: 44d80d9f256d
User: jamesjer
Date: 2014-06-14 19:06:24
Summary: Add format-spec.el.
Also remove spurious executable bits from xpm files and xpm-mode.el. See
<CAHCOHQkN0K=EM89OVCfkDycOZ0ogv3nj8bR3J_Cp9OWu512qoA@mail.gmail.com> in
xemacs-patches.
Affected #: 28 files
diff -r da2c71235bd8dbade52e3bd2ccf93b8e7cdcf61a -r 44d80d9f256d6206bcdeae698823ff55cae52457 ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-06-11 Jerry James <[email protected]>
+
+ * Makefile (ELCS): Add format-spec.elc and realphabetize.
+ * format-spec.el: New file, from Emacs.
+ * xpm-mode.el: Remove spurious executable permissions.
+ * *.xpm: Ditto.
+
2014-05-15 Norbert Koch <[email protected]>
* Makefile (VERSION): XEmacs package 2.03 released.
diff -r da2c71235bd8dbade52e3bd2ccf93b8e7cdcf61a -r 44d80d9f256d6206bcdeae698823ff55cae52457 Makefile
--- a/Makefile
+++ b/Makefile
@@ -27,14 +27,14 @@
REQUIRES = ispell fsf-compat xemacs-base
CATEGORY = standard
-ELCS = autoinsert.elc crontab.elc filladapt.elc flyspell.elc folding.elc \
- hexl.elc htmlize.elc image-mode.elc iso-acc.elc iso-ascii.elc \
- iso-cvt.elc iso-insert.elc iso-swed.elc nroff-mode.elc scribe.elc \
- swedish.elc tabify.elc tpum.elc underline.elc whitespace.elc \
- whitespace-mode.elc whitespace-visual-mode.elc winmgr-mode.elc \
- ws-mode.elc xpm-mode.elc xrdb-mode.elc ansi-color.elc \
- rtf-support.elc apache-mode.elc po-mode.elc po-compat.elc \
- css-mode.elc desktop-entry-mode.elc
+ELCS = ansi-color.elc apache-mode.elc autoinsert.elc crontab.elc css-mode.elc \
+ desktop-entry-mode.elc filladapt.elc flyspell.elc folding.elc \
+ format-spec.elc hexl.elc htmlize.elc image-mode.elc iso-acc.elc \
+ iso-ascii.elc iso-cvt.elc iso-insert.elc iso-swed.elc nroff-mode.elc \
+ po-compat.elc po-mode.elc rtf-support.elc scribe.elc swedish.elc \
+ tabify.elc tpum.elc underline.elc whitespace.elc whitespace-mode.elc \
+ whitespace-visual-mode.elc winmgr-mode.elc ws-mode.elc xpm-mode.elc \
+ xrdb-mode.elc
DATA_FILES = xpm-black-color-icon-48-48.xpm xpm-marker-icon-48-48.xpm \
xpm-rotate-cw-icon-48-48.xpm xpm-shift-up-icon-48-48.xpm \
diff -r da2c71235bd8dbade52e3bd2ccf93b8e7cdcf61a -r 44d80d9f256d6206bcdeae698823ff55cae52457 format-spec.el
--- /dev/null
+++ b/format-spec.el
@@ -0,0 +1,77 @@
+;;; format-spec.el --- functions for formatting arbitrary formatting strings
+
+;; Copyright (C) 1999-2014 Free Software Foundation, Inc.
+
+;; Author: Lars Magne Ingebrigtsen <[email protected]>
+;; Keywords: tools
+
+;; This file is part of XEmacs.
+
+;; XEmacs 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.
+
+;; XEmacs 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 XEmacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(defun format-spec (format specification)
+ "Return a string based on FORMAT and SPECIFICATION.
+FORMAT is a string containing `format'-like specs like \"bash %u %k\",
+while SPECIFICATION is an alist mapping from format spec characters
+to values. Any text properties on a %-spec itself are propagated to
+the text that it generates."
+ (with-temp-buffer
+ (insert format)
+ (goto-char (point-min))
+ (while (search-forward "%" nil t)
+ (cond
+ ;; Quoted percent sign.
+ ((eq (char-after) ?%)
+ (delete-char 1))
+ ;; Valid format spec.
+ ((looking-at "\\([-0-9.]*\\)\\([a-zA-Z]\\)")
+ (let* ((num (match-string 1))
+ (spec (string-to-char (match-string 2)))
+ (val (assq spec specification)))
+ (unless val
+ (error "Invalid format character: `%%%c'" spec))
+ (setq val (cdr val))
+ ;; Pad result to desired length.
+ (let ((text (format (concat "%" num "s") val)))
+ ;; Insert first, to preserve text properties.
+ (insert-and-inherit text)
+ ;; Delete the specifier body.
+ (delete-region (+ (match-beginning 0) (length text))
+ (+ (match-end 0) (length text)))
+ ;; Delete the percent sign.
+ (delete-region (1- (match-beginning 0)) (match-beginning 0)))))
+ ;; Signal an error on bogus format strings.
+ (t
+ (error "Invalid format string"))))
+ (buffer-string)))
+
+(defun format-spec-make (&rest pairs)
+ "Return an alist suitable for use in `format-spec' based on PAIRS.
+PAIRS is a list where every other element is a character and a value,
+starting with a character."
+ (let (alist)
+ (while pairs
+ (unless (cdr pairs)
+ (error "Invalid list of pairs"))
+ (push (cons (car pairs) (cadr pairs)) alist)
+ (setq pairs (cddr pairs)))
+ (nreverse alist)))
+
+(provide 'format-spec)
+
+;;; format-spec.el ends here
Repository URL: https://bitbucket.org/xemacs/text-modes/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.