[AC text-modes] Add format-spec.el
10 years, 4 months
Jerry James
APPROVE COMMIT
On Wed, Jun 11, 2014 at 9:14 AM, Jerry James <james(a)xemacs.org> wrote:
> PATCH text-modes
>
> I'm working on STARTTLS support, and need format-spec.el from Emacs
> for one bit of it. This seems like it could be a generally useful bit
> of elisp, so I propose adding it to the packages.
>
> While I was messing around with text-modes, I also removed a bunch of
> spurious executable permissions from xpm-mode.el and nearly all of the
> .xpm files.
I have committed this patch.
--
Jerry James
http://www.jamezone.org/
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/ispell: Jerry James: Specify encoding when using aspell.
10 years, 4 months
Bitbucket
1 new commit in ispell:
https://bitbucket.org/xemacs/ispell/commits/19fef39cb7b0/
Changeset: 19fef39cb7b0
User: Jerry James
Date: 2014-06-14 19:15:20
Summary: Specify encoding when using aspell.
This requires aspell version 0.60 or later. See xemacs-patches message
<CAHCOHQna+07mWT49iLOOEwVGL6bkMondakmPHNzCnJexBgZgnQ(a)mail.gmail.com>.
Affected #: 2 files
diff -r 083f2beaed8996529125b6b18cc494cb8c905247 -r 19fef39cb7b0637f30b4092a080035c1555c1405 ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-11 Jerry James <james(a)xemacs.org>
+
+ * ispell.el (ispell-start-process): fix encoding with aspell, and
+ assume that any aspell program is at least the decade-old aspell
+ 0.60.
+
2014-05-15 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.34 released.
diff -r 083f2beaed8996529125b6b18cc494cb8c905247 -r 19fef39cb7b0637f30b4092a080035c1555c1405 ispell.el
--- a/ispell.el
+++ b/ispell.el
@@ -2249,6 +2249,11 @@
(expand-file-name ispell-personal-dictionary)))))
(setq args (append args ispell-extra-args))
+ ;; If running aspell, fix the encoding; aspell >= 0.60 required
+ (when (string-match "^aspell" (file-name-nondirectory ispell-program-name))
+ (add-to-list
+ 'args (concat "--encoding=" (symbol-name (ispell-get-coding-system)))))
+
(if ispell-async-processp
(let ((process-connection-type ispell-use-ptys-p))
(apply 'start-process
Repository URL: https://bitbucket.org/xemacs/ispell/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/psgml: Jerry James: Modernize list of web browsers.
10 years, 4 months
Bitbucket
1 new commit in psgml:
https://bitbucket.org/xemacs/psgml/commits/bd13dcdc61d5/
Changeset: bd13dcdc61d5
User: Jerry James
Date: 2014-06-14 19:13:46
Summary: Modernize list of web browsers.
Also, allow use of the default browser, as defined by browse-url.el. See
<CAHCOHQm305bPr2UHGVGVu0v0byjDfZwwgtkG6unjAJwg56TBuQ(a)mail.gmail.com> in
xemacs-patches.
Affected #: 2 files
diff -r 6cb9f2b8abd9c2ea18420569237823b0ef347a0a -r bd13dcdc61d55aaddd44b1cf816719a88a8dd2d4 ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-06-11 Jerry James <james(a)xemacs.org>
+
+ * psgml-html.el (sgml-html-menu): Modernize list of browsers.
+ Allow use of the default browser.
+ (sgml-html-netscape-file): Use firefox instead of netscape.
+ (sgml-html-kfm-file): Use konqueror instead of kfm.
+
2014-05-15 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.47 released.
diff -r 6cb9f2b8abd9c2ea18420569237823b0ef347a0a -r bd13dcdc61d55aaddd44b1cf816719a88a8dd2d4 psgml-html.el
--- a/psgml-html.el
+++ b/psgml-html.el
@@ -931,25 +931,25 @@
(defvar sgml-html-menu
(cons "HTML"
- (append '(["View in Netscape" sgml-html-netscape-file
- (buffer-file-name
- (current-buffer))]
+ (append '(["View in default browser" browse-url-of-buffer t]
+ ["View in Firefox" sgml-html-netscape-file
+ (buffer-file-name (current-buffer))]
+ ["View in Konqueror" sgml-html-kfm-file
+ (buffer-file-name (current-buffer))]
["View in W3" w3-preview-this-buffer t]
- ["View in kfm" sgml-html-kfm-file
- (buffer-file-name (current-buffer))]
"---"
["HTML-Quote Region" html-quote-region t]
"---")
(cdr sgml-main-menu))))
(defun sgml-html-netscape-file ()
- "Preview the file for the current buffer in Netscape."
+ "Preview the file for the current buffer in Firefox."
(interactive)
- (browse-url-netscape
+ (browse-url-firefox
(concat "file:" (buffer-file-name (current-buffer)))))
(defun sgml-html-kfm-file ()
- "Preview the file for the current buffer in kfm."
+ "Preview the file for the current buffer in Konqueror."
(interactive)
(browse-url-kde
(concat "file:" (buffer-file-name (current-buffer)))))
Repository URL: https://bitbucket.org/xemacs/psgml/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/text-modes: jamesjer: Add format-spec.el.
10 years, 4 months
Bitbucket
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(a)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 <james(a)xemacs.org>
+
+ * 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 <viteno(a)xemacs.org>
* 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 <larsi(a)gnus.org>
+;; 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.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[PATCH ispell] Specify encoding to aspell
10 years, 4 months
Jerry James
PATCH ispell
This is another patch that Fedora has carried for years. If aspell
version 0.60 or later is in use, specify the text encoding. Since
version 0.60 was released very close to a decade ago (August 2004), I
think we can safely assume that older versions can be ignored.
diff -r 083f2beaed89 ChangeLog
--- a/ChangeLog Thu May 15 21:04:30 2014 +0200
+++ b/ChangeLog Wed Jun 11 09:50:30 2014 -0600
@@ -1,3 +1,9 @@
+2014-06-11 Jerry James <james(a)xemacs.org>
+
+ * ispell.el (ispell-start-process): fix encoding with aspell, and
+ assume that any aspell program is at least the decade-old aspell
+ 0.60.
+
2014-05-15 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.34 released.
diff -r 083f2beaed89 ispell.el
--- a/ispell.el Thu May 15 21:04:30 2014 +0200
+++ b/ispell.el Wed Jun 11 09:50:30 2014 -0600
@@ -2249,6 +2249,11 @@
(expand-file-name ispell-personal-dictionary)))))
(setq args (append args ispell-extra-args))
+ ;; If running aspell, fix the encoding; aspell >= 0.60 required
+ (when (string-match "^aspell" (file-name-nondirectory ispell-program-name))
+ (add-to-list
+ 'args (concat "--encoding=" (symbol-name (ispell-get-coding-system)))))
+
(if ispell-async-processp
(let ((process-connection-type ispell-use-ptys-p))
(apply 'start-process
--
Jerry James
http://www.jamezone.org/
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[PATCH psgml] Update list of web browsers
10 years, 4 months
Jerry James
PATCH psgml
This is a patch we've been carrying in Fedora for several years. I
think it is time to apply it to our repository.
diff -r 6cb9f2b8abd9 ChangeLog
--- a/ChangeLog Thu May 15 21:11:14 2014 +0200
+++ b/ChangeLog Wed Jun 11 09:41:01 2014 -0600
@@ -1,3 +1,10 @@
+2014-06-11 Jerry James <james(a)xemacs.org>
+
+ * psgml-html.el (sgml-html-menu): Modernize list of browsers.
+ Allow use of the default browser.
+ (sgml-html-netscape-file): Use firefox instead of netscape.
+ (sgml-html-kfm-file): Use konqueror instead of kfm.
+
2014-05-15 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.47 released.
diff -r 6cb9f2b8abd9 psgml-html.el
--- a/psgml-html.el Thu May 15 21:11:14 2014 +0200
+++ b/psgml-html.el Wed Jun 11 09:41:01 2014 -0600
@@ -931,25 +931,25 @@
(defvar sgml-html-menu
(cons "HTML"
- (append '(["View in Netscape" sgml-html-netscape-file
- (buffer-file-name
- (current-buffer))]
+ (append '(["View in default browser" browse-url-of-buffer t]
+ ["View in Firefox" sgml-html-netscape-file
+ (buffer-file-name (current-buffer))]
+ ["View in Konqueror" sgml-html-kfm-file
+ (buffer-file-name (current-buffer))]
["View in W3" w3-preview-this-buffer t]
- ["View in kfm" sgml-html-kfm-file
- (buffer-file-name (current-buffer))]
"---"
["HTML-Quote Region" html-quote-region t]
"---")
(cdr sgml-main-menu))))
(defun sgml-html-netscape-file ()
- "Preview the file for the current buffer in Netscape."
+ "Preview the file for the current buffer in Firefox."
(interactive)
- (browse-url-netscape
+ (browse-url-firefox
(concat "file:" (buffer-file-name (current-buffer)))))
(defun sgml-html-kfm-file ()
- "Preview the file for the current buffer in kfm."
+ "Preview the file for the current buffer in Konqueror."
(interactive)
(browse-url-kde
(concat "file:" (buffer-file-name (current-buffer)))))
--
Jerry James
http://www.jamezone.org/
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[PATCH text-modes] Add format-spec.el
10 years, 4 months
Jerry James
PATCH text-modes
I'm working on STARTTLS support, and need format-spec.el from Emacs
for one bit of it. This seems like it could be a generally useful bit
of elisp, so I propose adding it to the packages.
While I was messing around with text-modes, I also removed a bunch of
spurious executable permissions from xpm-mode.el and nearly all of the
.xpm files.
diff -r da2c71235bd8 ChangeLog
--- a/ChangeLog Thu May 15 21:13:00 2014 +0200
+++ b/ChangeLog Wed Jun 11 09:11:25 2014 -0600
@@ -1,3 +1,9 @@
+2014-06-11 Jerry James <james(a)xemacs.org>
+
+ * Makefile (ELCS): Add format-spec.elc and realphabetize.
+ * xpm-mode.el: Remove spurious executable permissions.
+ * *.xpm: Ditto.
+
2014-05-15 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 2.03 released.
diff -r da2c71235bd8 Makefile
--- a/Makefile Thu May 15 21:13:00 2014 +0200
+++ b/Makefile Wed Jun 11 09:11:25 2014 -0600
@@ -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 da2c71235bd8 format-spec.el
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/format-spec.el Wed Jun 11 09:11:25 2014 -0600
@@ -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 <larsi(a)gnus.org>
+;; 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
--
Jerry James
http://www.jamezone.org/
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/ocaml: Jerry James: Define faces the XEmacs way in caml-font.el. See xemacs-patches message
10 years, 4 months
Bitbucket
1 new commit in ocaml:
https://bitbucket.org/xemacs/ocaml/commits/b485116970ca/
Changeset: b485116970ca
User: Jerry James
Date: 2014-06-06 18:29:14
Summary: Define faces the XEmacs way in caml-font.el. See xemacs-patches message
<CAHCOHQkGnjCA8uTRwcHZxK9bM9qqO7=AYkrhjjR=UQqErY=SoA(a)mail.gmail.com>.
Affected #: 3 files
diff -r c4cb09505870daade773d501aa59d4abd04265c5 -r b485116970ca274a9eecfc4fa7e5a4a8d2f30a1d ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-05 Jerry James <james(a)xemacs.org>
+
+ * caml-font.el: Define faces the XEmacs way.
+
2014-05-15 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 0.08 released.
diff -r c4cb09505870daade773d501aa59d4abd04265c5 -r b485116970ca274a9eecfc4fa7e5a4a8d2f30a1d caml-font.el
--- a/caml-font.el
+++ b/caml-font.el
@@ -28,13 +28,11 @@
(setq font-lock-type-face 'DarkOliveGreen)
(setq font-lock-reference-face 'CadetBlue)))
; extra faces for documention
- (make-face 'Stop)
- (set-face-foreground 'Stop "White")
- (set-face-background 'Stop "Red")
- (make-face 'Doc)
- (set-face-foreground 'Doc "Red")
- (setq font-lock-stop-face 'Stop)
- (setq font-lock-doccomment-face 'Doc)
+ (make-face 'font-lock-stop-face)
+ (set-face-foreground 'font-lock-stop-face "White")
+ (set-face-background 'font-lock-stop-face "Red")
+ (make-face 'font-lock-doccomment-face)
+ (set-face-foreground 'font-lock-doccomment-face "Red")
))
; The same definition is in caml.el:
diff -r c4cb09505870daade773d501aa59d4abd04265c5 -r b485116970ca274a9eecfc4fa7e5a4a8d2f30a1d caml-font.el.upstream
--- /dev/null
+++ b/caml-font.el.upstream
@@ -0,0 +1,125 @@
+;; useful colors
+
+(cond
+ ((x-display-color-p)
+ (cond
+ ((not (memq 'font-lock-type-face (face-list)))
+ ; make the necessary faces
+ (make-face 'Firebrick)
+ (set-face-foreground 'Firebrick "Firebrick")
+ (make-face 'RosyBrown)
+ (set-face-foreground 'RosyBrown "RosyBrown")
+ (make-face 'Purple)
+ (set-face-foreground 'Purple "Purple")
+ (make-face 'MidnightBlue)
+ (set-face-foreground 'MidnightBlue "MidnightBlue")
+ (make-face 'DarkGoldenRod)
+ (set-face-foreground 'DarkGoldenRod "DarkGoldenRod")
+ (make-face 'DarkOliveGreen)
+ (set-face-foreground 'DarkOliveGreen "DarkOliveGreen4")
+ (make-face 'CadetBlue)
+ (set-face-foreground 'CadetBlue "CadetBlue")
+ ; assign them as standard faces
+ (setq font-lock-comment-face 'Firebrick)
+ (setq font-lock-string-face 'RosyBrown)
+ (setq font-lock-keyword-face 'Purple)
+ (setq font-lock-function-name-face 'MidnightBlue)
+ (setq font-lock-variable-name-face 'DarkGoldenRod)
+ (setq font-lock-type-face 'DarkOliveGreen)
+ (setq font-lock-reference-face 'CadetBlue)))
+ ; extra faces for documention
+ (make-face 'Stop)
+ (set-face-foreground 'Stop "White")
+ (set-face-background 'Stop "Red")
+ (make-face 'Doc)
+ (set-face-foreground 'Doc "Red")
+ (setq font-lock-stop-face 'Stop)
+ (setq font-lock-doccomment-face 'Doc)
+))
+
+; The same definition is in caml.el:
+; we don't know in which order they will be loaded.
+(defvar caml-quote-char "'"
+ "*Quote for character constants. \"'\" for Objective Caml, \"`\" for Caml-Light.")
+
+(defconst caml-font-lock-keywords
+ (list
+;stop special comments
+ '("\\(^\\|[^\"]\\)\\((\\*\\*/\\*\\*)\\)"
+ 2 font-lock-stop-face)
+;doccomments
+ '("\\(^\\|[^\"]\\)\\((\\*\\*[^*]*\\([^)*][^*]*\\*+\\)*)\\)"
+ 2 font-lock-doccomment-face)
+;comments
+ '("\\(^\\|[^\"]\\)\\((\\*[^*]*\\*+\\([^)*][^*]*\\*+\\)*)\\)"
+ 2 font-lock-comment-face)
+;character literals
+ (cons (concat caml-quote-char "\\(\\\\\\([ntbr" caml-quote-char "\\]\\|"
+ "[0-9][0-9][0-9]\\)\\|.\\)" caml-quote-char
+ "\\|\"[^\"\\]*\\(\\\\\\(.\\|\n\\)[^\"\\]*\\)*\"")
+ 'font-lock-string-face)
+;modules and constructors
+ '("`?\\<[A-Z][A-Za-z0-9_']*\\>" . font-lock-function-name-face)
+;definition
+ (cons (concat
+ "\\<\\(a\\(nd\\|s\\)\\|c\\(onstraint\\|lass\\)"
+ "\\|ex\\(ception\\|ternal\\)\\|fun\\(ct\\(ion\\|or\\)\\)?"
+ "\\|in\\(herit\\|itializer\\)?\\|let"
+ "\\|m\\(ethod\\|utable\\|odule\\)"
+ "\\|of\\|p\\(arser\\|rivate\\)\\|rec\\|type"
+ "\\|v\\(al\\(ue\\)?\\|irtual\\)\\)\\>")
+ 'font-lock-type-face)
+;blocking
+ '("\\<\\(begin\\|end\\|object\\|s\\(ig\\|truct\\)\\)\\>"
+ . font-lock-keyword-face)
+;control
+ (cons (concat
+ "\\<\\(do\\(ne\\|wnto\\)?\\|else\\|for\\|i\\(f\\|gnore\\)"
+ "\\|lazy\\|match\\|new\\|or\\|t\\(hen\\|o\\|ry\\)"
+ "\\|w\\(h\\(en\\|ile\\)\\|ith\\)\\)\\>"
+ "\\|\|\\|->\\|&\\|#")
+ 'font-lock-reference-face)
+ '("\\<raise\\>" . font-lock-comment-face)
+;labels (and open)
+ '("\\(\\([~?]\\|\\<\\)[a-z][a-zA-Z0-9_']*:\\)[^:=]" 1
+ font-lock-variable-name-face)
+ '("\\<\\(assert\\|open\\|include\\)\\>\\|[~?][ (]*[a-z][a-zA-Z0-9_']*"
+ . font-lock-variable-name-face)))
+
+(defconst inferior-caml-font-lock-keywords
+ (append
+ (list
+;inferior
+ '("^[#-]" . font-lock-comment-face))
+ caml-font-lock-keywords))
+
+;; font-lock commands are similar for caml-mode and inferior-caml-mode
+(setq caml-mode-hook
+ '(lambda ()
+ (cond
+ ((fboundp 'global-font-lock-mode)
+ (make-local-variable 'font-lock-defaults)
+ (setq font-lock-defaults
+ '(caml-font-lock-keywords nil nil ((?' . "w") (?_ . "w")))))
+ (t
+ (setq font-lock-keywords caml-font-lock-keywords)))
+ (make-local-variable 'font-lock-keywords-only)
+ (setq font-lock-keywords-only t)
+ (font-lock-mode 1)))
+
+(defun inferior-caml-mode-font-hook ()
+ (cond
+ ((fboundp 'global-font-lock-mode)
+ (make-local-variable 'font-lock-defaults)
+ (setq font-lock-defaults
+ '(inferior-caml-font-lock-keywords
+ nil nil ((?' . "w") (?_ . "w")))))
+ (t
+ (setq font-lock-keywords inferior-caml-font-lock-keywords)))
+ (make-local-variable 'font-lock-keywords-only)
+ (setq font-lock-keywords-only t)
+ (font-lock-mode 1))
+
+(add-hook 'inferior-caml-mode-hooks 'inferior-caml-mode-font-hook)
+
+(provide 'caml-font)
Repository URL: https://bitbucket.org/xemacs/ocaml/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches