diff -Nru emacs-goodies-el-35.12ubuntu3/debian/changelog emacs-goodies-el-36.3ubuntu1/debian/changelog --- emacs-goodies-el-35.12ubuntu3/debian/changelog 2016-04-22 23:11:08.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/changelog 2016-12-06 13:46:16.000000000 +0000 @@ -1,3 +1,90 @@ +emacs-goodies-el (36.3ubuntu1) zesty; urgency=low + + * Merge from Debian unstable. Remaining changes: + - debian-changelog-mode.el: Teach about Ubuntu releases. + + -- Dimitri John Ledkov Tue, 06 Dec 2016 14:46:16 +0100 + +emacs-goodies-el (36.3) unstable; urgency=high + + * emacs-goodies-el: + - Bug fix: "fails to upgrade/install", thanks to Brent S. Elmer + (Closes: #845216). Skip byte-compilation for minibuffer-complete-cycle.el on + emacs23. + + -- Peter S Galbraith Mon, 21 Nov 2016 15:20:03 -0500 + +emacs-goodies-el (36.2) unstable; urgency=medium + + * Bug fix: "partially incompatible with xemacs21", thanks to Aaron + M. Ucko (Closes: #844176). + + -- Peter S Galbraith Mon, 14 Nov 2016 10:04:16 -0500 + +emacs-goodies-el (36.1) unstable; urgency=medium + + * dpkg-dev-el: + - debian-changelog-mode.el tweak bug fix #803767. Thanks to + Vincent Bernat fo the heads up. + * emacs-goodies-el: + - tc.el bug fix: "tc.el (and other packages perhaps): save-excursion has + changed in emacs25 to save-mark-and-excursion", thanks to + Gijs Hillenius (Closes: #841059). + + -- Peter S Galbraith Tue, 08 Nov 2016 09:25:46 -0500 + +emacs-goodies-el (36.0) unstable; urgency=medium + + * Bug fix: "site-start files don't work", thanks to Samuel Bronson + (Closes: #751201). Added "emacsen-common (>= 2.0.8)" to all packages. + * emacs-goodies-el: + - markdown.el removed; use elpa-markdown-mode instead. + (Closes: #644903, #656868, #810035) + - dict.el removed; use dictionary-el instead. + (Closes: #840763, #611919, #718028) + - apache.el updated to 2015-08-23 version 2.0 + - minibuffer-complete-cycle.el updated to 1.25.20130814 + - quack.el updated to 0.48 + - minibuf-electric.el bug fix: "[patch] fix minibuf-electric.el for + emacs24", thanks to Karl Hegbloom (Closes: #803728). + - rfcview.el bug fix: "rfcview.el does not obey fill-column", thanks to + frozencemetery (Closes: #761139). + * Bug fix: "cyclebuffer busted", thanks to jidanni@jidanni.org; + (Closes: #613063). + * dpkg-dev-el: + - debian-changelog-mode.el bug fix: "don't rely on external date + (LP#1197870)", thanks to era eriksson and Pierre Carrier + (Closes: #803767). + - debian-changelog-mode.el bug fix: "highlight backports", thanks to + Kumar Appaiah (Closes: #708317). + + -- Peter S Galbraith Sun, 06 Nov 2016 14:47:29 -0500 + +emacs-goodies-el (35.13) unstable; urgency=medium + + * debian-el: + - Bug fix: "Missing ; in debian-bug.el first line header", thanks + to Antoine R. Dumont (Closes: #842566). + - Bug fix: "apt-sources.el duplicate auto-mode-alist sources.list", + thanks to Kevin Ryde (Closes: #712835). + * Bug fix: "apt-sources.el: Distribution names are out of date", thanks + to Memnon Anon (Closes: #705281). + * Bug fix: "should depend on xz-utils", thanks to Sven Joachim + (Closes: #638202). + * Bug fix: "gnus-BTS.el search for bugs against wrong url", thanks to + Marco Bardelli (Closes: #756208). + * Bug fix: "apt-utils.el should use word-at-point for default value for + package", thanks to Remi Vanicat (Closes: #613776). + * Bug fix: "please add all BTS commands (e.g. affects and usertags)", + thanks to Luca Capello (Closes: #643888). + * Bug fix: "improve handling of {old-, }stable-proposed-updates", thanks + to Guido Gunther (Closes: #818010). + * emacs-goodies-el: + - maplev.el update to 2.27 + - button-lock.el: new file needed by maplev.el + + -- Peter S Galbraith Sun, 06 Nov 2016 10:28:29 -0500 + emacs-goodies-el (35.12ubuntu3) yakkety; urgency=medium * Add xenial and yakkety. @@ -3200,3 +3287,4 @@ * Initial Release. -- Roland Mas <99.roland.mas@aist.enst.fr> Fri, 22 Dec 2000 14:09:40 +0100 + diff -Nru emacs-goodies-el-35.12ubuntu3/debian/control emacs-goodies-el-36.3ubuntu1/debian/control --- emacs-goodies-el-35.12ubuntu3/debian/control 2015-06-14 18:47:12.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/control 2016-11-22 04:44:45.000000000 +0000 @@ -10,8 +10,8 @@ Package: emacs-goodies-el Architecture: all -Depends: emacs | emacsen, bash (>= 2.05a) | bash-static, ${misc:Depends}, dpkg (>= 1.15.4) | install-info -Recommends: dict, wget, perl-doc +Depends: emacs | emacsen, emacsen-common (>= 2.0.8), bash (>= 2.05a) | bash-static, ${misc:Depends}, dpkg (>= 1.15.4) | install-info +Recommends: wget, perl-doc Replaces: emacs-goodies-extra-el Provides: emacs-goodies-extra-el Description: Miscellaneous add-ons for Emacs @@ -26,6 +26,7 @@ boxquote - quote texts in nice boxes; browse-huge-tar - browse tar files without reading them into memory; browse-kill-ring - browse, search, modify the kill ring; + button-lock - clickable text defined by regular expression; clipper - save strings of data for further use; coffee - now Emacs can even brew coffee; color-theme - changes the colors used within Emacs; @@ -33,7 +34,6 @@ ctypes - enhanced Font lock support for custom defined types; dedicated - make a window dedicated to a single buffer; df - display in the mode line space left on devices; - dict - wrapper around the 'dict' command. (Depends on bash and dict) diminish - shorten or erase modeline presence of minor modes; dir-locals - provides directory-wide local variables; edit-env - display, edit, delete and add environment variables; @@ -57,7 +57,6 @@ lcomp - list-completion hacks; maplev - major mode for Maple; map-lines - map a command over lines matching a regexp; - markdown-mode - major mode for editing Markdown files; marker-visit - navigate through a buffer's marks in order; matlab - major mode for MatLab dot-m files; minibuf-electric - electric minibuffer behavior from XEmacs; @@ -101,7 +100,7 @@ Package: devscripts-el Architecture: all -Depends: emacs | emacsen, bash (>= 2.05a), devscripts, dpkg-dev-el, apel, ${misc:Depends} +Depends: emacs | emacsen, emacsen-common (>= 2.0.8), bash (>= 2.05a), devscripts, dpkg-dev-el, apel, ${misc:Depends} Recommends: elserv Description: Emacs wrappers for the commands in devscripts This package contains: @@ -113,7 +112,8 @@ Package: debian-el Architecture: all -Depends: emacs | emacsen, reportbug (>= 4.12), ${misc:Depends}, dpkg (>= 1.15.4) | install-info, bzip2, file +Pre-Depends: xz-utils +Depends: emacs | emacsen, emacsen-common (>= 2.0.8), reportbug (>= 4.12), ${misc:Depends}, dpkg (>= 1.15.4) | install-info, bzip2, file Recommends: wget, dlocate, groff-base Suggests: gnus Replaces: debbugs-el, debview @@ -134,7 +134,7 @@ Package: dpkg-dev-el Architecture: all -Depends: emacs | emacsen, debian-el (>= 33.2), ${misc:Depends} +Depends: emacs | emacsen, emacsen-common (>= 2.0.8), debian-el (>= 33.2), ${misc:Depends} Suggests: dpkg-dev Recommends: wget Conflicts: dpkg-dev (<< 1.7.2) diff -Nru emacs-goodies-el-35.12ubuntu3/debian/emacs-goodies-el.copyright emacs-goodies-el-36.3ubuntu1/debian/emacs-goodies-el.copyright --- emacs-goodies-el-35.12ubuntu3/debian/emacs-goodies-el.copyright 2015-06-14 18:43:47.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/emacs-goodies-el.copyright 2016-11-22 04:44:45.000000000 +0000 @@ -95,6 +95,10 @@ Copyright: 2001 Colin Walters License: GPL-2+ +Files: elisp/emacs-goodies-el/button-lock.el +Copyright: 2011 D Roland Walker +License: GPL-2+ + Files: elisp/emacs-goodies-el/clipper.el Copyright: 1997-2000 Free Software Foundation, Inc. License: GPL-2+ @@ -149,10 +153,6 @@ License: GPL-2+ Comment: Author: Benjamin Drieu -Files: elisp/emacs-goodies-el/dict.el -Copyright: 2002 Max Vasin -License: GPL-2+ - Files: elisp/emacs-goodies-el/diminish.el Copyright: 1998 Free Software Foundation, Inc. License: GPL-2+ @@ -280,16 +280,12 @@ Comment: Authors: Joseph S. Riel and Roland Winkler - URL: http://www.k-online.com/~joer/maplev/maplev.html + URL: https://github.com/JoeRiel/maplev Files: elisp/emacs-goodies-el/map-lines.el Copyright: 2002 Andreas Fuchs License: GPL-2+ -Files: elisp/emacs-goodies-el/markdown-mode.el -Copyright: 2007 Jason Blevins -License: GPL-2+ - Files: elisp/emacs-goodies-el/marker-visit.el Copyright: 2001 Benjamin Rutt License: GPL-2+ diff -Nru emacs-goodies-el-35.12ubuntu3/debian/emacs-goodies-el.emacsen-install.in emacs-goodies-el-36.3ubuntu1/debian/emacs-goodies-el.emacsen-install.in --- emacs-goodies-el-35.12ubuntu3/debian/emacs-goodies-el.emacsen-install.in 2015-06-14 18:43:47.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/emacs-goodies-el.emacsen-install.in 2016-11-22 04:44:45.000000000 +0000 @@ -16,13 +16,12 @@ # INCLUDED_emacs21="" # INCLUDED_xemacs21="" -EXCLUDED_emacs20="tabbar.el session.el csv-mode.el maplev.el pod-mode.el markdown-mode.el" -EXCLUDED_emacs21="pod-mode.el markdown-mode.el" -EXCLUDED_emacs22="markdown-mode.el" -EXCLUDED_xemacs21="csv-mode.el minibuf-electric.el pp-c-l.el tabbar.el todoo.el rfcview.el upstart-mode.el " +EXCLUDED_emacs20="tabbar.el session.el csv-mode.el maplev.el pod-mode.el button-lock.el" +EXCLUDED_emacs21="pod-mode.el" +EXCLUDED_xemacs21="csv-mode.el minibuf-electric.el pp-c-l.el tabbar.el todoo.el rfcview.el upstart-mode.el maplev.el button-lock.el" #EXCLUDED_emacs_snapshot="cua.el cfengine.el ibuffer.el ido.el newsticker.el table.el " #EXCLUDED_emacs22="cua.el cfengine.el ibuffer.el ido.el newsticker.el table.el " -#EXCLUDED_emacs23="cua.el cfengine.el ibuffer.el ido.el newsticker.el table.el " +EXCLUDED_emacs23="minibuffer-complete-cycle.el" # Skip byte-compilation here if necessary: #SOURCEONLY_all="emacs-goodies-el.el emacs-goodies-loaddefs.el" diff -Nru emacs-goodies-el-35.12ubuntu3/debian/emacs-goodies-el.install emacs-goodies-el-36.3ubuntu1/debian/emacs-goodies-el.install --- emacs-goodies-el-35.12ubuntu3/debian/emacs-goodies-el.install 2011-11-07 21:43:14.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/emacs-goodies-el.install 2016-11-22 04:44:45.000000000 +0000 @@ -8,6 +8,7 @@ elisp/emacs-goodies-el/boxquote.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/browse-huge-tar.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/browse-kill-ring.el /usr/share/emacs/site-lisp/emacs-goodies-el/ +elisp/emacs-goodies-el/button-lock.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/coffee.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/color-theme.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/color-theme-library.el /usr/share/emacs/site-lisp/emacs-goodies-el/ @@ -17,7 +18,6 @@ elisp/emacs-goodies-el/ctypes.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/dedicated.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/df.el /usr/share/emacs/site-lisp/emacs-goodies-el/ -elisp/emacs-goodies-el/dict.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/diminish.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/dir-locals.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/edit-env.el /usr/share/emacs/site-lisp/emacs-goodies-el/ @@ -45,7 +45,6 @@ elisp/emacs-goodies-el/lcomp.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/maplev.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/map-lines.el /usr/share/emacs/site-lisp/emacs-goodies-el/ -elisp/emacs-goodies-el/markdown-mode.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/marker-visit.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/matlab.el /usr/share/emacs/site-lisp/emacs-goodies-el/ elisp/emacs-goodies-el/minibuf-electric.el /usr/share/emacs/site-lisp/emacs-goodies-el/ diff -Nru emacs-goodies-el-35.12ubuntu3/debian/patches/50_dict_bug301293.diff emacs-goodies-el-36.3ubuntu1/debian/patches/50_dict_bug301293.diff --- emacs-goodies-el-35.12ubuntu3/debian/patches/50_dict_bug301293.diff 2015-06-14 18:43:47.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/patches/50_dict_bug301293.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -## 50_dict_bug301293.diff by - ---- a/elisp/emacs-goodies-el/dict.el 2009-09-03 21:50:58.000000000 -0400 -+++ b/elisp/emacs-goodies-el/dict.el 2009-09-03 21:55:19.000000000 -0400 -@@ -480,14 +480,29 @@ - ((string-match "exited abnormally with code" msg) - (message msg))))))) - -+;;(defsubst dict-default-dict-entry () -+;; "Make a guess at a default dict entry. -+;;This guess is based on the text surrounding the cursor." -+;; (let (word) -+;; (save-excursion -+;; (setq word (current-word)) -+;; (if (string-match "[._]+$" word) -+;; (setq word (substring word 0 (match-beginning 0)))) -+;; word))) -+ -+;; Debian Bug 301293 reported and patched by Jorgen Schaefer -+;; `current-word' can return nil, which causes this function to -+;; error out in the `string-match'. Also, `save-excursion' doesn't -+;; do anything here. -+;; -+;; This should be written as: - (defsubst dict-default-dict-entry () -- "Make a guess at a default dict entry. -+ "Make a guess at the default dict entry. - This guess is based on the text surrounding the cursor." -- (let (word) -- (save-excursion -- (setq word (current-word)) -- (if (string-match "[._]+$" word) -- (setq word (substring word 0 (match-beginning 0)))) -+ (let ((word (or (current-word) -+ ""))) -+ (if (string-match "[._]+$" word) -+ (substring word 0 (match-beginning 0)) - word))) - - ;;;; diff -Nru emacs-goodies-el-35.12ubuntu3/debian/patches/50_gnus-BTS.diff emacs-goodies-el-36.3ubuntu1/debian/patches/50_gnus-BTS.diff --- emacs-goodies-el-35.12ubuntu3/debian/patches/50_gnus-BTS.diff 2015-06-14 18:43:47.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/patches/50_gnus-BTS.diff 2016-11-22 04:44:46.000000000 +0000 @@ -109,7 +109,7 @@ "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=" - "http://cgi.debian.org/cgi-bin/search_packages.pl?&searchon=names&version=all&release=all&keywords="))) + (concat -+ "http://cgi.debian.org/cgi-bin/search_packages.pl" ++ "http://bugs.debian.org/cgi-bin/bugreport.cgi" + "?&searchon=names&version=all&release=all&keywords=")))) (browse-url (concat url bug-or-feature)))) diff -Nru emacs-goodies-el-35.12ubuntu3/debian/patches/50_maplev_bug528868.diff emacs-goodies-el-36.3ubuntu1/debian/patches/50_maplev_bug528868.diff --- emacs-goodies-el-35.12ubuntu3/debian/patches/50_maplev_bug528868.diff 2015-06-14 18:43:47.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/patches/50_maplev_bug528868.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -## 50_maplev_bug528868.diff by Peter S Galbraith - ---- a/elisp/emacs-goodies-el/maplev.texi -+++ b/elisp/emacs-goodies-el/maplev.texi -@@ -11,6 +11,11 @@ - - @include version.texi - -+@dircategory Emacs -+@direntry -+* maplev: (maplev). Emacs major mode for Maple V -+@end direntry -+ - @iftex - @tolerance 10000 - @end iftex diff -Nru emacs-goodies-el-35.12ubuntu3/debian/patches/50_maplevtexi.diff emacs-goodies-el-36.3ubuntu1/debian/patches/50_maplevtexi.diff --- emacs-goodies-el-35.12ubuntu3/debian/patches/50_maplevtexi.diff 1970-01-01 00:00:00.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/patches/50_maplevtexi.diff 2014-07-08 20:02:16.000000000 +0000 @@ -0,0 +1,45 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 50_maplevtexi.diff.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' emacs-goodies-el~/elisp/emacs-goodies-el/maplev.texi emacs-goodies-el/elisp/emacs-goodies-el/maplev.texi +--- emacs-goodies-el~/elisp/emacs-goodies-el/maplev.texi 2014-07-08 15:53:02.000000000 -0400 ++++ emacs-goodies-el/elisp/emacs-goodies-el/maplev.texi 2014-07-08 16:00:11.050362706 -0400 +@@ -1,10 +1,10 @@ + \input texinfo + ++@set VERSION 2.27 ++@set DATE June 2011 + @setfilename maplev + @settitle MapleV Emacs Mode @value{VERSION} + +-@set VERSION 2.27 +-@set DATE June 2011 + + @dircategory Emacs + @direntry +@@ -12,7 +12,11 @@ + @end direntry + + +-@include version.texi ++@set UPDATED 2 January 2010 ++@c Edition of the Manual ++@set EDITION 1.1 ++@c Version of the Code ++@set VERSION 2.16 + + @iftex + @tolerance 10000 +@@ -225,7 +229,7 @@ + + @node GNU Free Documentation License, Introduction, Copying, top + @unnumbered GNU Free Documentation License +-@include fdl.texi ++@c @include fdl.texi + + + diff -Nru emacs-goodies-el-35.12ubuntu3/debian/patches/50_rfcview.diff emacs-goodies-el-36.3ubuntu1/debian/patches/50_rfcview.diff --- emacs-goodies-el-35.12ubuntu3/debian/patches/50_rfcview.diff 1970-01-01 00:00:00.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/patches/50_rfcview.diff 2016-11-06 18:44:12.000000000 +0000 @@ -0,0 +1,11 @@ +--- a/elisp/emacs-goodies-el/rfcview.el ++++ b/elisp/emacs-goodies-el/rfcview.el +@@ -376,7 +376,7 @@ + (if (= n 0) "?" (1+ n)))))) + (overlay-put overlay + 'before-string +- (concat (make-string (max (- 79 ++ (concat (make-string (max (- fill-column + (- (match-beginning 1) + (match-beginning 0)) + (length page-str)) diff -Nru emacs-goodies-el-35.12ubuntu3/debian/patches/50_tc.diff emacs-goodies-el-36.3ubuntu1/debian/patches/50_tc.diff --- emacs-goodies-el-35.12ubuntu3/debian/patches/50_tc.diff 1970-01-01 00:00:00.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/patches/50_tc.diff 2016-11-08 14:22:30.000000000 +0000 @@ -0,0 +1,177 @@ +--- a/elisp/emacs-goodies-el/tc.el ++++ b/elisp/emacs-goodies-el/tc.el +@@ -79,6 +79,12 @@ + ;; start and (mark t) at end. + + ;;; Code: ++;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841059 ++;; Fix by Gijs Hillenius ++(eval-when-compile ++ (when (< emacs-major-version 25) ++ (defmacro save-mark-and-excursion (&rest body) ++ `(save-excursion ,@body)))) + + ;;; ************************************************************ + ;;; External requirements here +@@ -394,7 +400,7 @@ + (defun tc-do-remove-sig () + "Attempt to remove the signature from already quoted text. + Warns if it is longer than 4 lines (5 including signature mark '-- ')." +- (save-excursion ++ (save-mark-and-excursion + (setq tc-removed-sig nil) + (setq tc-removed-sig-marker nil) + (exchange-point-and-mark) +@@ -413,7 +419,7 @@ + "Make the signature be after filling in undo list, and quoted." + (if tc-removed-sig + (progn +- (save-excursion ++ (save-mark-and-excursion + (goto-char (marker-position tc-removed-sig-marker)) + (insert tc-removed-sig) + (let ((sig-end (point-marker))) +@@ -447,7 +453,7 @@ + Replaces any sequence of cite-marks such as \"> |: }\" with a uniform string + of the citemarks of your choice, e.g. \">>>> \"." + (interactive "r") +- (save-excursion ++ (save-mark-and-excursion + (goto-char start) + (let ((end-marker (set-marker (make-marker) end))) + (while (< (point) (marker-position end-marker)) +@@ -479,7 +485,7 @@ + (defun tc-remove-trailing-whitespace () + "Remove trailing whitespace." + ;; First remove trailing empty lines +- (save-excursion ++ (save-mark-and-excursion + (if (< (point) (mark t)) + (exchange-point-and-mark)) + (let ((end-cite (point))) +@@ -543,7 +549,7 @@ + "*Cite the region like `trivial-cite', but without parsing headers. + Doesn't cut the signature either. Region is between START and END." + (interactive "r") +- (save-excursion ++ (save-mark-and-excursion + (if (> start end) + (let ((tmp start)) (setq start end) (setq end tmp))) + (goto-char start) +@@ -572,7 +578,7 @@ + + (defun tc-fix-final-newline () + "Add a newline if there is not one at the end of the cited text." +- (save-excursion ++ (save-mark-and-excursion + (exchange-point-and-mark) + (if (not (bolp)) + (insert "\n")))) +@@ -594,7 +600,7 @@ + Customization: See variables tc-fill-column, tc-remove-signature, + tc-citation-string, tc-make-attribution and tc-header-funs." + (run-hooks 'tc-pre-hook) +- (save-excursion ++ (save-mark-and-excursion + (if (< (mark t) (point)) (exchange-point-and-mark)) + (let ((start (point))) + ;; Initialize some fields +@@ -617,7 +623,7 @@ + (tc-do-remove-sig)) + (tc-remove-trailing-whitespace) + (if tc-max-lines +- (save-excursion ++ (save-mark-and-excursion + (message (concat "Only citing " + (int-to-string tc-max-lines) " lines")) + (goto-char start) +@@ -663,7 +669,7 @@ + paragraph." + (interactive "nLength of citation marks: ") + (let (fill-end) +- (save-excursion ++ (save-mark-and-excursion + (save-restriction + (beginning-of-line) + (let ((cite-marks (buffer-substring (point) (+ (point) cite-len))) +@@ -740,7 +746,7 @@ + "Find the length of the citation marking at point P. + This is so we can fix it when filling. + Used internally in `tc-fill-cited-text'." +- (save-excursion ++ (save-mark-and-excursion + (goto-char p) + (forward-line 1) + (let ((forward-prefix-length (tc-line-common-prefix-length p (point)))) +@@ -773,7 +779,7 @@ + Done on region between START and END. + Uses a seperate undo-mechanism (with overlays) to allow partial undo." + (interactive "r") +- (save-excursion ++ (save-mark-and-excursion + (goto-char start) + (while (< (point) end) + (beginning-of-line) +@@ -797,7 +803,7 @@ + (defun tc-line-common-prefix-length (p1 p2) + "Return the number of characters the two lines have as common prefix. + The two lines are at point P1 and P2." +- (save-excursion ++ (save-mark-and-excursion + (let ((line1 (progn (goto-char p1) (beginning-of-line) + (let ((line-start (point))) + (end-of-line) +@@ -824,7 +830,7 @@ + marks, as it regards the shortest common prefix of the lines as citation + marks." + (interactive "r") +-;;(save-excursion ++;;(save-mark-and-excursion + (goto-char start) + (beginning-of-line) + (let ((line-start (point))) +@@ -851,7 +857,7 @@ + This function finds the longest possible citemark and wraps all lines as + if they had that amount of citemarks." + (interactive "r") +-;;(save-excursion ++;;(save-mark-and-excursion + (goto-char end) + (let ((end-mark (point-marker)) + (cite-marks "")) +@@ -897,7 +903,7 @@ + (interactive "d") + (let ((reformatted (get-char-property at 'tc-reformat))) + (if reformatted +- (save-excursion ++ (save-mark-and-excursion + (let ((removed-region (buffer-substring + (overlay-start (cdr reformatted)) + (overlay-end (cdr reformatted))))) +@@ -923,7 +929,7 @@ + (substring known-marks (length (concat "\n " tc-normal-citemarks))))) + + (defun tc-guess-cite-marks () +- (save-excursion ++ (save-mark-and-excursion + (let ((best-prefix "\n") + guessed-marks + marks-begin marks-end) +@@ -948,7 +954,7 @@ + guessed-marks))) + + (defun tc-citemarks-need-guessing () +- (save-excursion ++ (save-mark-and-excursion + (let ((max-line-len (- (tc-fill-column) (length tc-citation-string) 1)) + needed) + (beginning-of-line) +@@ -967,7 +973,7 @@ + ;; Doesn't work yet. *sniff* + (defun tc-reply-to-citee-p (email) + "Whether the mail being composed is for the person being cited." +- (save-excursion ++ (save-mark-and-excursion + (beginning-of-buffer) + (if (re-search-forward "^To:[ \t]+\\(.*\\)\n" nil t) + (if (equal email (buffer-substring (match-beginning 1) (match-end 1))) diff -Nru emacs-goodies-el-35.12ubuntu3/debian/patches/56_make_local_hook.diff emacs-goodies-el-36.3ubuntu1/debian/patches/56_make_local_hook.diff --- emacs-goodies-el-35.12ubuntu3/debian/patches/56_make_local_hook.diff 2015-06-14 18:42:15.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/patches/56_make_local_hook.diff 2016-11-22 04:44:46.000000000 +0000 @@ -20,30 +20,3 @@ (add-hook 'post-command-hook (function egocentric-post-command-hook) t t) (egocentric-update-regexp-list) (egocentric-insinuate egocentric-regexp-list) ---- a/elisp/emacs-goodies-el/maplev.el -+++ b/elisp/emacs-goodies-el/maplev.el -@@ -1853,13 +1853,15 @@ - ;; the file's local variables specs might change maplev-release - ;; xemacs version of make-local-hook returns t, not the hook. (JR) - ;; make-local-hook is obsolete in GNU emacs 21.1 -- (make-local-hook 'hack-local-variables-hook) -+ (if (fboundp 'make-local-hook) -+ (make-local-hook 'hack-local-variables-hook)) - (add-hook 'hack-local-variables-hook 'maplev-mode-name nil t) - - ;; Set hooks - (if maplev-clean-buffer-before-saving-flag - (add-hook 'local-write-file-hooks 'maplev-remove-trailing-spaces)) -- (make-local-hook 'before-change-functions) -+ (if (fboundp 'make-local-hook) -+ (make-local-hook 'before-change-functions)) - (add-hook 'before-change-functions 'maplev--before-change-function nil t) - (run-hooks 'maplev-mode-hook)) - -@@ -4887,4 +4889,4 @@ - - (provide 'maplev) - --;;; maplev.el ends here -\ No newline at end of file -+;;; maplev.el ends here diff -Nru emacs-goodies-el-35.12ubuntu3/debian/patches/series emacs-goodies-el-36.3ubuntu1/debian/patches/series --- emacs-goodies-el-35.12ubuntu3/debian/patches/series 2015-06-14 18:43:47.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/patches/series 2016-12-06 13:46:16.000000000 +0000 @@ -1,3 +1,5 @@ +50_tc.diff +50_rfcview.diff 40_missing_provide.diff 49_bar-cursor-customize.diff 50_bar-cursor_bug331430.diff @@ -6,7 +8,6 @@ 50_coffee_no-autoload.diff 50_color-theme_custom.diff 50_dedicated.diff -50_dict_bug301293.diff 50_diminish-defcustom.diff 51_diminishSamuelBronson.diff 50_edit-env_autoload.diff @@ -18,7 +19,7 @@ 50_highlight-beyond-fill-column.diff 50_joc-toggle-case.diff 50_joc-toggle-buffer.diff -50_maplev_bug528868.diff +50_maplevtexi.diff 50_marker-visit_autoloads.diff 50_session_enable_custom.diff 51_session_autoload.diff diff -Nru emacs-goodies-el-35.12ubuntu3/debian/README.Debian emacs-goodies-el-36.3ubuntu1/debian/README.Debian --- emacs-goodies-el-35.12ubuntu3/debian/README.Debian 2015-06-14 18:43:47.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/debian/README.Debian 2016-11-22 04:44:45.000000000 +0000 @@ -48,6 +48,9 @@ through your kill ring, perform searches on it, and insert items into a buffer. +button-lock.el is a minor mode which provides simple facilities to +define clickable text based on regular expressions (used by maplev.el). + cfengine.el is an Emacs major-mode for editing cfengine scripts. clipper.el provides the M-x clipper-* commands to save strings of data @@ -74,12 +77,6 @@ df.el provides M-x df, to display in the mode line space left on devices. -dict.el is an Emacs wrapper around `dict' command to provide access to -a dictd server from within Emacs. The package provides several -(customisable) key bindings, here are two of the default ones: `C-c d -d' runs dict on the word at point. `C-c d r' runs dict on region as a -single word. - diminish.el provides M-x diminish, M-x diminish-undo and M-x diminished-modes. Diminished modes are minor modes with a shorter or no modeline display. @@ -176,9 +173,6 @@ map-lines.el provides M-x map-lines, a command to iterate a given command over lines matching a regexp. -markdown-mode.el provides support for editing Markdown files. It -provides syntax highlighting and basic element insertion commands. - marker-visit.el provides a simple way to navigate among marks in a buffer. All the marks you've left while editing a buffer serve as bread crumb trails of areas in the buffer you've edited. It is convenient to navigate @@ -313,4 +307,4 @@ .Xenvironment, .Xresources or *.ad after having enabled it by customising `xrdb-mode-setup-auto-mode-alist'. - -- Julian Gilbey , Sun, 2 Feb 2014 09:25:53 +0000 + -- Peter S Galbraith , Sun, 6 Nov 2016 14:50:31 -0500 diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/debian-el/apt-sources.el emacs-goodies-el-36.3ubuntu1/elisp/debian-el/apt-sources.el --- emacs-goodies-el-35.12ubuntu3/elisp/debian-el/apt-sources.el 2011-11-07 21:43:14.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/debian-el/apt-sources.el 2016-11-22 04:44:44.000000000 +0000 @@ -6,7 +6,7 @@ ;; $Source: ;; Author: Dr. Rafael Sepúlveda. -;; Mantainer: Peter S. Galbraith +;; Maintainer: Peter S. Galbraith ;; (I can't find Dr. Rafael Sepúlveda) ;; Copyright (C) 2001-2003, Dr. Rafael Sepúlveda @@ -310,8 +310,9 @@ ("frozen" 3) ("stable" 4) ("sid" 5) - ("sarge" 6) - ("woody" 7)) nil t)) + ("squeeze" 6) + ("wheezy" 7) + ("jessie" 8)) nil t)) (components (completing-read "Components: " ;list of componenst used by APT. '(("main") ("main contrib") @@ -456,8 +457,9 @@ ("frozen" 3) ("stable" 4) ("sid" 5) - ("sarge" 6) - ("woody" 7)) nil t))) + ("squeeze" 6) + ("wheezy" 7) + ("jessie" 8)) nil t))) (save-excursion (beginning-of-line) (delete-region (re-search-forward ":/*[^ ]*." (line-end-position) t 1) @@ -515,7 +517,8 @@ (run-hooks 'apt-sources-load-hook) -(add-to-list 'auto-mode-alist '("sources.list$" . apt-sources-mode)) +(add-to-list 'auto-mode-alist '("sources\\.list\\'" . apt-sources-mode)) +(add-to-list 'auto-mode-alist '("sources\\.list\\.d/.*\\.list\\'" . apt-sources-mode)) (provide 'apt-sources) ;;; apt-sources.el ends here diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/debian-el/apt-utils.el emacs-goodies-el-36.3ubuntu1/elisp/debian-el/apt-utils.el --- emacs-goodies-el-35.12ubuntu3/elisp/debian-el/apt-utils.el 2011-11-07 21:43:14.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/debian-el/apt-utils.el 2016-11-22 04:44:44.000000000 +0000 @@ -3,7 +3,7 @@ ;;; Copyright (C) 2002-2010 Matthew P. Hodges ;; Author: Matthew P. Hodges -;; $Id: apt-utils.el,v 1.22 2011-06-24 16:34:46 psg Exp $ +;; $Id: apt-utils.el,v 1.23 2016/11/05 22:18:48 psg Exp $ ;; apt-utils.el is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -41,6 +41,7 @@ (require 'browse-url) (require 'jka-compr) +(require 'thingatpt) (defalias 'apt-utils-puthash 'puthash) @@ -1332,7 +1333,7 @@ (text-properties-at (point)))))) (PC-word-delimiters "-")) (when (not (stringp package)) - (setq package nil)) + (setq package (word-at-point))) (completing-read (if package (format "Choose Debian package (%s): " package) "Choose Debian package: ") diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/debian-el/debian-bug.el emacs-goodies-el-36.3ubuntu1/elisp/debian-el/debian-bug.el --- emacs-goodies-el-35.12ubuntu3/elisp/debian-el/debian-bug.el 2015-06-14 18:43:47.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/debian-el/debian-bug.el 2016-11-22 04:44:44.000000000 +0000 @@ -1,4 +1,4 @@ -;; debian-bug.el --- report a bug to Debian's bug tracking system +;;; debian-bug.el --- report a bug to Debian's bug tracking system ;; Copyright (C) 1998, 1999 Free Software Foundation, Inc. ;; Copyright (C) 2001, 2002, 2003, 2004 Peter S Galbraith @@ -340,6 +340,10 @@ ;; Updated `debian-bug-pseudo-packages'. ;; V1.76 30Jan2014 Peter S Galbraith ;; Finally applied patch from Sven Joachim to fix Bug #679390. Sorry! +;; V1.77 06Nov2016 Peter S Galbraith +;; - Updated tags +;; - Bug fix: "Missing ; in debian-bug.el first line header", thanks +;; to Antoine R. Dumont (Closes: #842566). ;;---------------------------------------------------------------------------- ;;; Todo (Peter's list): @@ -547,8 +551,8 @@ '(("patch") ("wontfix") ("moreinfo") ("unreproducible") ("help") ("pending") ("fixed") ("fixed-in-experimental") ("fixed-upstream") ("security") ("upstream") ("confirmed") ("d-i") ("ipv6") ("lfs") ("l10n") ("potato") - ("woody") ("sarge") ("sarge-ignore") ("etch") ("etch-ignore") ("sid") - ("experimental")) + ("woody") ("sarge") ("sarge-ignore") ("etch") ("etch-ignore") ("lenny") + ("squeeze") ("wheezy") ("jessie") ("sid") ("experimental")) "Alist of all valid Tags, aimed at Debian developpers.") (defvar debian-bug-pseudo-packages diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/debian-el/debian-el.el emacs-goodies-el-36.3ubuntu1/elisp/debian-el/debian-el.el --- emacs-goodies-el-35.12ubuntu3/elisp/debian-el/debian-el.el 2011-11-07 21:43:14.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/debian-el/debian-el.el 2016-11-22 04:44:44.000000000 +0000 @@ -1,4 +1,4 @@ -`;;; debian-el.el --- startup file for the debian-el package +;;; debian-el.el --- startup file for the debian-el package ;;; Commentary: ;; diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/dpkg-dev-el/debian-bts-control.el emacs-goodies-el-36.3ubuntu1/elisp/dpkg-dev-el/debian-bts-control.el --- emacs-goodies-el-35.12ubuntu3/elisp/dpkg-dev-el/debian-bts-control.el 2011-11-07 21:43:14.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/dpkg-dev-el/debian-bts-control.el 2016-11-22 04:44:44.000000000 +0000 @@ -74,6 +74,11 @@ ;; - Emacs BTS moved to debbugs.gnu.org ;; V1.15 22Feb2010 Peter S Galbraith ;; - add autoload cookie for `emacs-bts-control' (Closes: #565934) +;; V1.16 05Nov2016 Peter S Galbraith +;; Bug fix: "please add all BTS commands (e.g. affects and usertags)", +;; thanks to Luca Capello (Closes: #643888). +;; - Add `affects', `forcemerge', `summary' and font-lock for `tag'. +;; - Remove `close' ;;; Code: (eval-when-compile '(require 'cl)) @@ -139,6 +144,7 @@ :selected (debian-bug--is-CC debian-bug-From-address "cc:")] ) "--" + ["Affects" (debian-bts-control "affects") t] ["Package" (debian-bts-control "package") t] ["Reassign" (debian-bts-control "reassign") t] ["Reopen" (debian-bts-control "reopen") t] @@ -149,8 +155,10 @@ ["NotForwarded" (debian-bts-control "notforwarded") t] ["Retitle" (debian-bts-control "retitle") t] ["Severity" (debian-bts-control "severity") t] + ["Summary" (debian-bts-control "summary") t] ["Clone" (debian-bts-control "clone") t] ["Merge" (debian-bts-control "merge") t] + ["ForceMerge" (debian-bts-control "forcemerge") t] ["UnMerge" (debian-bts-control "unmerge") t] ["Tags" (debian-bts-control "tags") t] ["Close" (debian-bts-control "close") t] @@ -177,6 +185,14 @@ (defvar debian-bts-control-font-lock-keywords '(("#.*$" . font-lock-comment-face) ("^ *thank.*$" . font-lock-function-name-face) + ("^ *\\(summary\\) +\\(-?[0-9]+\\) *\\(.*\\)$" + (1 font-lock-function-name-face) + (2 font-lock-type-face) + (3 font-lock-string-face)) + ("^ *\\(affects\\) +\\(-?[0-9]+\\) *\\(.*\\)$" + (1 font-lock-function-name-face) + (2 font-lock-type-face) + (3 font-lock-string-face)) ("^ *\\(found\\) +\\(-?[0-9]+\\) *\\(.*\\)$" (1 font-lock-function-name-face) (2 font-lock-type-face) @@ -260,22 +276,23 @@ (1 font-lock-function-name-face) (2 font-lock-type-face) (3 font-lock-keyword-face)) + ("^ *\\(forcemerge\\) +\\(-?[0-9]+ +-?[0-9]+\\( +-?[0-9]+\\)*\\)$" + (1 font-lock-function-name-face) + (2 font-lock-type-face) + (3 font-lock-keyword-face)) ("^ *\\(unmerge\\) +\\(-?[0-9]+\\)$" (1 font-lock-function-name-face) (2 font-lock-type-face)) - ("^ *\\(tags\\) +\\(-?[0-9]+\\) +\\([-+=]? +\\)?\\(security\\)" + ("^ *\\(tags?\\) +\\(-?[0-9]+\\) +\\([-+=]? +\\)?\\(security\\)" (1 font-lock-function-name-face) (2 font-lock-type-face) (3 font-lock-keyword-face nil t) (4 font-lock-warning-face)) - ("^ *\\(tags\\) +\\(-?[0-9]+\\) +\\([-+=]? +\\)?\\(patch\\|wontfix\\|moreinfo\\|unreproducible\\|help\\|pending\\|fixed-in-experimental\\|fixed-upstream\\|fixed\\|security\\|upstream\\|confirmed\\|d-i\\|ipv6\\|lfs\\|l10n\\|potato\\|woody\\|sarge-ignore\\|sarge\\|etch-ignore\\|etch\\|sid\\|experimental\\)" + ("^ *\\(tags?\\) +\\(-?[0-9]+\\) +\\([-+=]? +\\)?\\(patch\\|wontfix\\|moreinfo\\|unreproducible\\|help\\|pending\\|fixed-in-experimental\\|fixed-upstream\\|fixed\\|security\\|upstream\\|confirmed\\|d-i\\|ipv6\\|lfs\\|l10n\\|potato\\|woody\\|sarge-ignore\\|sarge\\|etch-ignore\\|etch\\|jessie\\|jessie-ignore\\|sid\\|experimental\\)" (1 font-lock-function-name-face) (2 font-lock-type-face) (3 font-lock-keyword-face nil t) - (4 font-lock-keyword-face)) - ("^ *\\(close\\) +\\(-?[0-9]+\\)$" - (1 font-lock-warning-face) - (2 font-lock-type-face))) + (4 font-lock-keyword-face))) "Regexp keywords to fontify `debian-bts-control' reports.") (defun debian-bts-control-minor-mode (arg) @@ -308,9 +325,9 @@ (defvar debian-bts-control-alist '(("reassign") ("severity") ("reopen") ("submitter") ("forwarded") ("notforwarded") ("retitle") ("clone") ("merge") ("unmerge") - ("tags") ("close") ("package") ("owner") ("noowner") ("found") + ("tags") ("package") ("owner") ("noowner") ("found") ("notfound") ("fixed") ("notfixed") ("block") ("unblock") ("archive") - ("unarchive")) + ("unarchive") ("affects") ("forcemerge") ("summary")) "List of available commands at control@bugs.debian.org.") (defun debian-bts-bug-number-at-point () @@ -411,6 +428,35 @@ (concat verbose "Package list to limit to: ") (debian-bug-fill-packages-obarray) nil nil))) (insert (format "package %s\n" package)))) + ((string-equal "affects" action) + (debian-bug-fill-packages-obarray) + (let* ((verbose (if debian-bts-control-verbose-prompts-flag + "affects bugnumber [ + | - | = ] package [ package ... ] + + Indicates that a bug affects another package. In the case where + bugnumber causes breakage in package even though the bug is + actually present in the package to which it is assigned, this + causes the bug to be listed by default in the bug list of + package. This should generally be used where the bug is severe + enough to cause multiple reports from users to be assigned to + the wrong package. = sets the affects to the list of packages + given, and is the default action if no packages are given; - + removes the given packages from the affects list; + adds the + given packages to the affects list, and is the default if + packages are given. + +" + "")) + (bug-number (debian-bts-control-prompt + (concat verbose "Bug number") + number-default)) + (sign (completing-read + (concat verbose "[ + | - | = ] ") + '(("+") ("-") ("=")) nil nil)) + (package (completing-read + (concat verbose "Package affected: ") + (debian-bug-fill-packages-obarray) nil nil))) + (insert (format "affects %s %s %s \n" bug-number sign package)))) ((string-equal "reassign" action) (debian-bug-fill-packages-obarray) (let* ((verbose (if debian-bts-control-verbose-prompts-flag @@ -560,6 +606,36 @@ (title (read-string (concat verbose "New title: ")))) (insert (format "retitle %s %s\n" bug-number title)))) + ((string-equal "summary" action) + (let* ((verbose (if debian-bts-control-verbose-prompts-flag + "summary bugnumber [message number | summary text] + + Selects a message to use as a summary of a bug. The first + non-pseudoheader/non-control paragraph of that message is parsed + and set as the summary of the bug which is displayed on the top + of the bug report page. This is useful in cases where the + original report doesn't correctly describe the problem or the + bug has many messages which make it difficult to identify the + actual problem. + + If message number is not given, clears the summary. message + number is the message number as listed in the bugreport cgi + script output; if a message number of 0 is given, the current + message is used (that is, the message which was sent to + control@bugs.debian.org which contains the summary control + command). + + If message number is not numerical and not the empty string, it + is assumed to be the text to set the summary to. + +" + "")) + (bug-number (debian-bts-control-prompt + (concat verbose "Bug number") + number-default)) + (title (read-string + (concat verbose "Summary: ")))) + (insert (format "summary %s %s\n" bug-number title)))) ((string-equal "severity" action) (let* ((verbose (if debian-bts-control-verbose-prompts-flag "severity bugnumber severity @@ -616,6 +692,24 @@ "")) (bug-numbers (read-string (concat verbose "All bug numbers: ")))) (insert (format "merge %s\n" bug-numbers)))) + ((string-equal "forcemerge" action) + (let* ((verbose (if debian-bts-control-verbose-prompts-flag + "forcemerge bugnumber bugnumber ... + + Forcibly merges two or more bug reports. The settings of the + first bug listed which must be equal in a normal merge are + assigned to the bugs listed next. To avoid typos erroneously + merging bugs, bugs must be in the same package. See the text + above for a description of what merging means. + + Note that this makes it possible to close bugs by merging; you + are responsible for notifying submitters with an appropriate + close message if you do this. + +" + "")) + (bug-numbers (read-string (concat verbose "All bug numbers: ")))) + (insert (format "forcemerge %s\n" bug-numbers)))) ((string-equal "unmerge" action) (let* ((verbose (if debian-bts-control-verbose-prompts-flag "unmerge bugnumber diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/dpkg-dev-el/debian-changelog-mode.el emacs-goodies-el-36.3ubuntu1/elisp/dpkg-dev-el/debian-changelog-mode.el --- emacs-goodies-el-35.12ubuntu3/elisp/dpkg-dev-el/debian-changelog-mode.el 2016-04-22 23:10:48.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/dpkg-dev-el/debian-changelog-mode.el 2016-12-06 13:46:16.000000000 +0000 @@ -347,7 +347,16 @@ ;; Simplify auto-mode-alist (Closes: #587924) ;; V1.95 01Dec2013 Matt Kraai ;; Change the default urgency to medium (Closes: #731105) -;; +;; V1.96 06Nov2016 Guido Günther +;; Bug fix: "improve handling of {old-, }stable-proposed-updates", thanks +;; to Guido Gunther (Closes: #818010). +;; V1.97 06Nov2016 Pierre Carrier (on 2013-07-04) +;; https://bugs.launchpad.net/ubuntu/+source/emacs-goodies-el/+bug/1197870 +;; Bug fix #803767 debian-changelog-mode: don't rely on external date +;; See also https://github.com/pcarrier/debian-changelog-mode/commit/285d4cc938468fd3d7d74584da7981705727fbab +;; V1.98 06Nov2016 Kumar Appaiah +;; highlight backports (Closes: #708317) + ;;; Acknowledgements: (These people have contributed) ;; Roland Rosenfeld ;; James LewisMoss @@ -394,7 +403,9 @@ "testing-security" "stable" "stable-security" + "stable-proposed-updates" "oldstable-security" + "oldstable-proposed-updates" "experimental" "hardy" "lucid" @@ -409,6 +420,7 @@ "wily" "xenial" "yakkety" + "zesty" "UNRELEASED" ) "*Allowed values for distribution." :group 'debian-changelog @@ -714,7 +726,10 @@ ("--") ["stable" (debian-changelog-setdistribution "stable") t] ["stable-security" (debian-changelog-setdistribution "stable-security") t] + ["stable-proposed-updates" (debian-changelog-setdistribution "stable-proposed-updates") t] + ("--") ["oldstable-security" (debian-changelog-setdistribution "oldstable-security") t] + ["oldstable-proposed-updates" (debian-changelog-setdistribution "oldstable-proposed-updates") t] ("--") ["experimental" (debian-changelog-setdistribution "experimental") t] ["UNRELEASED" (debian-changelog-setdistribution "UNRELEASED") t]) @@ -765,7 +780,10 @@ ("--") ["stable" (debian-changelog-setdistribution "stable") t] ["stable-security" (debian-changelog-setdistribution "stable-security") t] + ["stable-proposed-updates" (debian-changelog-setdistribution "stable-proposed-updates") t] + ("--") ["oldstable-security" (debian-changelog-setdistribution "oldstable-security") t] + ["oldstable-proposed-updates" (debian-changelog-setdistribution "oldstable-proposed-updates") t] ("--") ["experimental" (debian-changelog-setdistribution "experimental") t] ["UNRELEASED" (debian-changelog-setdistribution "UNRELEASED") t]) @@ -1210,33 +1228,9 @@ (defun debian-changelog-date-string () "Return RFC-822 format date string. Use UTC if `debian-changelog-date-utc-flag' is non-nil." - (let* ((dp "date") - (cp (point)) - (ret - (let ((process-environment process-environment) - (tz (dolist (item process-environment) - (when (and (stringp item) - (string-match "^TZ=" item)) - (return item))))) - (when debian-changelog-date-utc-flag - (setq process-environment - (delete tz process-environment)) - (push "TZ=UTC" process-environment)) - (call-process "date" nil t nil "-R"))) - (np (point)) - (out nil)) - (cond ((not (or (eq ret nil) (eq ret 0))) - (setq out (buffer-substring-no-properties cp np)) - (delete-region cp np) - (error (concat "error from " dp ": " out))) - (t - (backward-char) - (or (looking-at "\n") - (error (concat "error from " dp ": expected newline after date string"))) - (setq out (buffer-substring-no-properties cp (- np 1))) - (delete-region cp np) - out)))) - + (let ((system-time-locale "C")) + (format-time-string "%a, %d %b %Y %T %z" nil + debian-changelog-date-utc-flag))) ;; ;; interactive functions to finalize entry ;; @@ -1468,6 +1462,7 @@ (3 font-lock-string-face nil t) (4 debian-changelog-warning-face nil t)) '(debian-changelog-fontify-stable . debian-changelog-warning-face) + '(debian-changelog-fontify-backports . debian-changelog-warning-face) '(debian-changelog-fontify-frozen . font-lock-type-face) '(debian-changelog-fontify-unstable . font-lock-string-face) '(debian-changelog-fontify-experimental . debian-changelog-warning-face) @@ -1580,7 +1575,7 @@ t)) (defun debian-changelog-fontify-stable (limit) - (when (re-search-forward "^\\sw.* (.+).* \\(\\(old\\)?stable\\(-security\\)?\\)" limit t) + (when (re-search-forward "^\\sw.* (.+).* \\(\\(old\\)?stable\\(-security\\|-proposed-updates\\)?\\)" limit t) (store-match-data (list (match-beginning 1)(match-end 1))) t)) @@ -1608,6 +1603,12 @@ (store-match-data (list (match-beginning 1)(match-end 1))) t)) + +(defun debian-changelog-fontify-backports (limit) + (when (re-search-forward "^\\sw.* (.+).* \\([a-z][a-z]*-backports\\)" limit t) + (store-match-data + (list (match-beginning 1)(match-end 1))) + t)) ;; ;; browse-url interfaces, by Peter Galbraith, Feb 23 2001 diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/apache-mode.el emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/apache-mode.el --- emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/apache-mode.el 2011-11-07 21:43:14.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/apache-mode.el 2016-11-22 04:44:45.000000000 +0000 @@ -7,7 +7,7 @@ ;; Keywords: languages, faces ;; Last edit: 2005-01-06 -;; Version: 2.0 $Id: apache-mode.el,v 1.5 2009-09-03 14:41:25 psg Exp $ +;; Version: 2.0 $Id: apache-mode.el,v 1.6 2016/11/06 19:22:39 psg Exp $ ;; apache-mode.el 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 @@ -46,6 +46,9 @@ ;; ;; 2005-06-29 Kumar Appaiah ;; use syntax table instead of font-lock-keywords to highlight comments. +;; +;; 2015-08-23 David Maus +;; update list of directives for Apache 2.4 ;;; Code: @@ -120,10 +123,8 @@ "^[ \t]*" (regexp-opt ' ( - - "AcceptMutex" + "AcceptFilter" "AcceptPathInfo" - "AccessConfig" "AccessFileName" "Action" "AddAlt" @@ -139,97 +140,147 @@ "AddIconByType" "AddInputFilter" "AddLanguage" - "AddModule" "AddModuleInfo" "AddOutputFilter" "AddOutputFilterByType" "AddType" - "AgentLog" "Alias" "AliasMatch" - "Allow from" "Allow" "AllowCONNECT" "AllowEncodedSlashes" + "AllowMethods" "AllowOverride" + "AllowOverrideList" "Anonymous" - "Anonymous_Authoritative" "Anonymous_LogEmail" "Anonymous_MustGiveEmail" "Anonymous_NoUserID" "Anonymous_VerifyEmail" - "AssignUserID" - "AuthAuthoritative" - "AuthDBAuthoritative" - "AuthDBGroupFile" - "AuthDBMAuthoritative" + "AsyncRequestWorkerFactor" + "AuthBasicAuthoritative" + "AuthBasicFake" + "AuthBasicProvider" + "AuthBasicUseDigestAlgorithm" + "AuthDBDUserPWQuery" + "AuthDBDUserRealmQuery" "AuthDBMGroupFile" "AuthDBMType" "AuthDBMUserFile" - "AuthDBUserFile" "AuthDigestAlgorithm" "AuthDigestDomain" - "AuthDigestFile" - "AuthDigestGroupFile" - "AuthDigestNcCheck" - "AuthDigestNonceFormat" "AuthDigestNonceLifetime" + "AuthDigestProvider" "AuthDigestQop" "AuthDigestShmemSize" + "AuthFormAuthoritative" + "AuthFormBody" + "AuthFormDisableNoStore" + "AuthFormFakeBasicAuth" + "AuthFormLocation" + "AuthFormLoginRequiredLocation" + "AuthFormLoginSuccessLocation" + "AuthFormLogoutLocation" + "AuthFormMethod" + "AuthFormMimetype" + "AuthFormPassword" + "AuthFormProvider" + "AuthFormSitePassphrase" + "AuthFormSize" + "AuthFormUsername" "AuthGroupFile" - "AuthLDAPAuthoritative" + "AuthLDAPAuthorizePrefix" + "AuthLDAPBindAuthoritative" "AuthLDAPBindDN" "AuthLDAPBindPassword" "AuthLDAPCharsetConfig" + "AuthLDAPCompareAsUser" "AuthLDAPCompareDNOnServer" "AuthLDAPDereferenceAliases" - "AuthLDAPEnabled" - "AuthLDAPFrontPageHack" "AuthLDAPGroupAttribute" "AuthLDAPGroupAttributeIsDN" + "AuthLDAPInitialBindAsUser" + "AuthLDAPInitialBindPattern" + "AuthLDAPMaxSubGroupDepth" + "AuthLDAPRemoteUserAttribute" "AuthLDAPRemoteUserIsDN" + "AuthLDAPSearchAsUser" + "AuthLDAPSubGroupAttribute" + "AuthLDAPSubGroupClass" "AuthLDAPUrl" + "AuthMerging" "AuthName" + "AuthnCacheContext" + "AuthnCacheEnable" + "AuthnCacheProvideFor" + "AuthnCacheSOCache" + "AuthnCacheTimeout" + "AuthnzFcgiCheckAuthnProvider" + "AuthnzFcgiDefineProvider" "AuthType" "AuthUserFile" - "BS2000Account" - "BindAddress" + "AuthzDBDLoginToReferer" + "AuthzDBDQuery" + "AuthzDBDRedirectQuery" + "AuthzDBMType" + "AuthzSendForbiddenOnFailure" + "BalancerGrowth" + "BalancerInherit" + "BalancerMember" + "BalancerPersist" "BrowserMatch" "BrowserMatchNoCase" - "CGIMapExtension" + "BufferedLogs" + "BufferSize" "CacheDefaultExpire" + "CacheDetailHeader" "CacheDirLength" "CacheDirLevels" "CacheDisable" "CacheEnable" - "CacheExpiryCheck" "CacheFile" - "CacheForceCompletion" - "CacheGcClean" - "CacheGcDaily" - "CacheGcInterval" - "CacheGcMemUsage" - "CacheGcUnused" + "CacheHeader" "CacheIgnoreCacheControl" + "CacheIgnoreHeaders" "CacheIgnoreNoLastMod" + "CacheIgnoreQueryString" + "CacheIgnoreURLSessionIdentifiers" + "CacheKeyBaseURL" "CacheLastModifiedFactor" + "CacheLock" + "CacheLockMaxAge" + "CacheLockPath" "CacheMaxExpire" "CacheMaxFileSize" + "CacheMinExpire" "CacheMinFileSize" "CacheNegotiatedDocs" + "CacheQuickHandler" + "CacheReadSize" + "CacheReadTime" "CacheRoot" - "CacheSize" - "CacheTimeMargin" + "CacheSocache" + "CacheSocacheMaxSize" + "CacheSocacheMaxTime" + "CacheSocacheMinTime" + "CacheSocacheReadSize" + "CacheSocacheReadTime" + "CacheStaleOnError" + "CacheStoreExpired" + "CacheStoreNoStore" + "CacheStorePrivate" + "CGIDScriptTimeout" + "CGIMapExtension" + "CGIPassAuth" "CharsetDefault" "CharsetOptions" "CharsetSourceEnc" + "CheckCaseOnly" "CheckSpelling" - "ChildPerUserID" - "ClearModuleList" + "ChrootDir" "ContentDigest" "CookieDomain" "CookieExpires" - "CookieLog" "CookieName" "CookieStyle" "CookieTracking" @@ -237,152 +288,242 @@ "CustomLog" "Dav" "DavDepthInfinity" + "DavGenericLockDB" "DavLockDB" "DavMinTimeout" + "DBDExptime" + "DBDInitSQL" + "DBDKeep" + "DBDMax" + "DBDMin" + "DBDParams" + "DBDPersist" + "DBDPrepareSQL" + "DBDriver" "DefaultIcon" "DefaultLanguage" - "DefaultMode" + "DefaultRuntimeDir" "DefaultType" + "Define" "DeflateBufferSize" "DeflateCompressionLevel" "DeflateFilterNote" + "DeflateInflateLimitRequestBody" + "DeflateInflateRatioBurst" + "DeflateInflateRatioLimit" "DeflateMemLevel" "DeflateWindowSize" "Deny" + "DirectoryCheckHandler" "DirectoryIndex" + "DirectoryIndexRedirect" "DirectorySlash" - "DocTitle" - "DocTrailer" "DocumentRoot" + "DTracePrivileges" + "DumpIOInput" + "DumpIOOutput" "EnableExceptionHook" "EnableMMAP" "EnableSendfile" + "Error" "ErrorDocument" "ErrorLog" + "ErrorLogFormat" "Example" "ExpiresActive" "ExpiresByType" "ExpiresDefault" + "ExtendedStatus" "ExtFilterDefine" "ExtFilterOptions" - "ExtendedStatus" - "FancyIndexing" + "FallbackResource" "FileETag" + "FilterChain" + "FilterDeclare" + "FilterProtocol" + "FilterProvider" + "FilterTrace" "ForceLanguagePriority" "ForceType" "ForensicLog" + "GprofDir" + "GracefulShutdownTimeout" "Group" - "HTMLDir" - "HTTPLogFile" - "HeadPrefix" - "HeadSuffix" "Header" "HeaderName" - "HideSys" - "HideURL" - "HostNameLookups" + "HeartbeatAddress" + "HeartbeatListen" + "HeartbeatMaxServers" + "HeartbeatStorage" + "HeartbeatStorage" "HostnameLookups" - "ISAPIAppendLogToErrors" - "ISAPIAppendLogToQuery" - "ISAPICacheFile" - "ISAPIFakeAsync" - "ISAPILogNotSupported" - "ISAPIReadAheadBuffer" "IdentityCheck" + "IdentityCheckTimeout" "ImapBase" "ImapDefault" "ImapMenu" "Include" + "IncludeOptional" + "IndexHeadInsert" "IndexIgnore" + "IndexIgnoreReset" "IndexOptions" "IndexOrderDefault" + "IndexStyleSheet" + "InputSed" + "ISAPIAppendLogToErrors" + "ISAPIAppendLogToQuery" + "ISAPICacheFile" + "ISAPIFakeAsync" + "ISAPILogNotSupported" + "ISAPIReadAheadBuffer" "KeepAlive" "KeepAliveTimeout" + "KeptBodySize" + "LanguagePriority" "LDAPCacheEntries" "LDAPCacheTTL" + "LDAPConnectionPoolTTL" + "LDAPConnectionTimeout" + "LDAPLibraryDebug" "LDAPOpCacheEntries" "LDAPOpCacheTTL" + "LDAPReferralHopLimit" + "LDAPReferrals" + "LDAPRetries" + "LDAPRetryDelay" "LDAPSharedCacheFile" "LDAPSharedCacheSize" - "LDAPTrustedCA" - "LDAPTrustedCAType" - "LanguagePriority" - "LastURLs" + "LDAPTimeout" + "LDAPTrustedClientCert" + "LDAPTrustedGlobalCert" + "LDAPTrustedMode" + "LDAPVerifyServerCert" "LimitInternalRecursion" "LimitRequestBody" "LimitRequestFields" - "LimitRequestFieldsize" + "LimitRequestFieldSize" "LimitRequestLine" "LimitXMLRequestBody" "Listen" - "ListenBacklog" + "ListenBackLog" "LoadFile" "LoadModule" - "LockFile" "LogFormat" + "LogIOTrackTTFB" "LogLevel" - "MCacheMaxObjectCount" - "MCacheMaxObjectSize" - "MCacheMaxStreamingBuffer" - "MCacheMinObjectSize" - "MCacheRemovalAlgorithm" - "MCacheSize" - "MMapFile" - "MaxClients" + "LogMessage" + "LuaAuthzProvider" + "LuaCodeCache" + "LuaHookAccessChecker" + "LuaHookAuthChecker" + "LuaHookCheckUserID" + "LuaHookFixups" + "LuaHookInsertFilter" + "LuaHookLog" + "LuaHookMapToStorage" + "LuaHookTranslateName" + "LuaHookTypeChecker" + "LuaInherit" + "LuaInputFilter" + "LuaMapHandler" + "LuaOutputFilter" + "LuaPackageCPath" + "LuaPackagePath" + "LuaQuickHandler" + "LuaRoot" + "LuaScope" + "MaxConnectionsPerChild" "MaxKeepAliveRequests" "MaxMemFree" - "MaxRequestsPerChild" - "MaxRequestsPerThread" + "MaxRangeOverlaps" + "MaxRangeReversals" + "MaxRanges" + "MaxRequestWorkers" "MaxSpareServers" "MaxSpareThreads" "MaxThreads" - "MaxThreadsPerChild" + "MergeTrailers" "MetaDir" "MetaFiles" "MetaSuffix" "MimeMagicFile" "MinSpareServers" "MinSpareThreads" + "MMapFile" + "ModemStandard" "ModMimeUsePathInfo" "MultiviewsMatch" - "NWSSLTrustedCerts" - "NWSSLUpgradeable" + "Mutex" "NameVirtualHost" - "NoCache" "NoProxy" - "NumServers" + "NWSSLTrustedCerts" + "NWSSLUpgradeable" "Options" "Order" + "OutputSed" "PassEnv" "PidFile" - "Port" - "PrivateDir" + "PrivilegesMode" + "Protocol" "ProtocolEcho" + "ProxyAddHeaders" "ProxyBadHeader" "ProxyBlock" "ProxyDomain" "ProxyErrorOverride" + "ProxyExpressDBMFile" + "ProxyExpressDBMType" + "ProxyExpressEnable" + "ProxyFtpDirCharset" + "ProxyFtpEscapeWildcards" + "ProxyFtpListOnWildcard" + "ProxyHTMLBufSize" + "ProxyHTMLCharsetOut" + "ProxyHTMLDocType" + "ProxyHTMLEnable" + "ProxyHTMLEvents" + "ProxyHTMLExtended" + "ProxyHTMLFixups" + "ProxyHTMLInterp" + "ProxyHTMLLinks" + "ProxyHTMLMeta" + "ProxyHTMLStripComments" + "ProxyHTMLURLMap" "ProxyIOBufferSize" "ProxyMaxForwards" "ProxyPass" + "ProxyPassInherit" + "ProxyPassInterpolateEnv" + "ProxyPassMatch" "ProxyPassReverse" + "ProxyPassReverseCookieDomain" + "ProxyPassReverseCookiePath" "ProxyPreserveHost" "ProxyReceiveBufferSize" "ProxyRemote" "ProxyRemoteMatch" "ProxyRequests" + "ProxySCGIInternalRedirect" + "ProxySCGISendfile" + "ProxySet" + "ProxySourceAddress" + "ProxyStatus" "ProxyTimeout" "ProxyVia" - "RLimitCPU" - "RLimitMEM" - "RLimitNPROC" "ReadmeName" + "ReceiveBufferSize" "Redirect" "RedirectMatch" "RedirectPermanent" "RedirectTemp" - "RefererIgnore" - "RefererLog" + "ReflectorHeader" + "RemoteIPHeader" + "RemoteIPInternalProxy" + "RemoteIPInternalProxyList" + "RemoteIPProxiesHeader" + "RemoteIPTrustedProxy" + "RemoteIPTrustedProxyList" "RemoveCharset" "RemoveEncoding" "RemoveHandler" @@ -391,105 +532,178 @@ "RemoveOutputFilter" "RemoveType" "RequestHeader" + "RequestReadTimeout" "Require" - "ResourceConfig" "RewriteBase" "RewriteCond" "RewriteEngine" - "RewriteLock" - "RewriteLog" - "RewriteLogLevel" "RewriteMap" "RewriteOptions" "RewriteRule" + "RLimitCPU" + "RLimitMEM" + "RLimitNPROC" + "Satisfy" + "ScoreBoardFile" + "Script" + "ScriptAlias" + "ScriptAliasMatch" + "ScriptInterpreterSource" + "ScriptLog" + "ScriptLogBuffer" + "ScriptLogLength" + "ScriptSock" + "SecureListen" + "SeeRequestTail" + "SendBufferSize" + "ServerAdmin" + "ServerAlias" + "ServerLimit" + "ServerName" + "ServerPath" + "ServerRoot" + "ServerSignature" + "ServerTokens" + "Session" + "SessionCookieName" + "SessionCookieName2" + "SessionCookieRemove" + "SessionCryptoCipher" + "SessionCryptoDriver" + "SessionCryptoPassphrase" + "SessionCryptoPassphraseFile" + "SessionDBDCookieName" + "SessionDBDCookieName2" + "SessionDBDCookieRemove" + "SessionDBDDeleteLabel" + "SessionDBDInsertLabel" + "SessionDBDPerUser" + "SessionDBDSelectLabel" + "SessionDBDUpdateLabel" + "SessionEnv" + "SessionExclude" + "SessionHeader" + "SessionInclude" + "SessionMaxAge" + "SetEnv" + "SetEnvIf" + "SetEnvIfExpr" + "SetEnvIfNoCase" + "SetHandler" + "SetInputFilter" + "SetOutputFilter" "SSIEndTag" "SSIErrorMsg" + "SSIETag" + "SSILastModified" + "SSILegacyExprParser" "SSIStartTag" "SSITimeFormat" "SSIUndefinedEcho" "SSLCACertificateFile" "SSLCACertificatePath" + "SSLCADNRequestFile" + "SSLCADNRequestPath" + "SSLCARevocationCheck" "SSLCARevocationFile" "SSLCARevocationPath" "SSLCertificateChainFile" "SSLCertificateFile" "SSLCertificateKeyFile" "SSLCipherSuite" + "SSLCompression" + "SSLCryptoDevice" "SSLEngine" - "SSLMutex" + "SSLFIPS" + "SSLHonorCipherOrder" + "SSLInsecureRenegotiation" + "SSLOCSPDefaultResponder" + "SSLOCSPEnable" + "SSLOCSPOverrideResponder" + "SSLOCSPResponderTimeout" + "SSLOCSPResponseMaxAge" + "SSLOCSPResponseTimeSkew" + "SSLOCSPUseRequestNonce" + "SSLOpenSSLConfCmd" "SSLOptions" "SSLPassPhraseDialog" "SSLProtocol" "SSLProxyCACertificateFile" "SSLProxyCACertificatePath" + "SSLProxyCARevocationCheck" "SSLProxyCARevocationFile" "SSLProxyCARevocationPath" + "SSLProxyCheckPeerCN" + "SSLProxyCheckPeerExpire" + "SSLProxyCheckPeerName" "SSLProxyCipherSuite" "SSLProxyEngine" + "SSLProxyMachineCertificateChainFile" "SSLProxyMachineCertificateFile" "SSLProxyMachineCertificatePath" "SSLProxyProtocol" "SSLProxyVerify" "SSLProxyVerifyDepth" "SSLRandomSeed" + "SSLRenegBufferSize" "SSLRequire" "SSLRequireSSL" "SSLSessionCache" "SSLSessionCacheTimeout" + "SSLSessionTicketKeyFile" + "SSLSessionTickets" + "SSLSRPUnknownUserSeed" + "SSLSRPVerifierFile" + "SSLStaplingCache" + "SSLStaplingErrorCacheTimeout" + "SSLStaplingFakeTryLater" + "SSLStaplingForceURL" + "SSLStaplingResponderTimeout" + "SSLStaplingResponseMaxAge" + "SSLStaplingResponseTimeSkew" + "SSLStaplingReturnResponderErrors" + "SSLStaplingStandardCacheTimeout" + "SSLStrictSNIVHostCheck" + "SSLUserName" + "SSLUseStapling" "SSLVerifyClient" "SSLVerifyDepth" - "Satisfy" - "ScoreBoardFile" - "Script" - "ScriptAlias" - "ScriptAliasMatch" - "ScriptInterpreterSource" - "ScriptLog" - "ScriptLogBuffer" - "ScriptLogLength" - "ScriptSock" - "SecureListen" - "SendBufferSize" - "ServerAdmin" - "ServerAlias" - "ServerLimit" - "ServerName" - "ServerPath" - "ServerRoot" - "ServerSignature" - "ServerTokens" - "ServerType" - "SetEnv" - "SetEnvIf" - "SetEnvIfNoCase" - "SetHandler" - "SetInputFilter" - "SetOutputFilter" "StartServers" "StartThreads" + "Substitute" + "SubstituteMaxLineLength" + "Suexec" "SuexecUserGroup" "ThreadLimit" - "ThreadStackSize" "ThreadsPerChild" + "ThreadStackSize" "TimeOut" - "TopSites" - "TopURLs" + "TraceEnable" "TransferLog" "TypesConfig" + "UnDefine" + "UndefMacro" "UnsetEnv" + "Use" "UseCanonicalName" + "UseCanonicalPhysicalPort" "User" "UserDir" + "VHostCGIMode" + "VHostCGIPrivs" + "VHostGroup" + "VHostPrivs" + "VHostSecure" + "VHostUser" "VirtualDocumentRoot" "VirtualDocumentRootIP" "VirtualScriptAlias" "VirtualScriptAliasIP" - "Win32DisableAcceptEx" + "WatchdogInterval" "XBitHack" - "deny" - "order" - "require" - + "xml2EncAlias" + "xml2EncDefault" + "xml2StartParse" ) 'words)) 1 'font-lock-keyword-face) diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/button-lock.el emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/button-lock.el --- emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/button-lock.el 1970-01-01 00:00:00.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/button-lock.el 2014-07-08 18:42:45.000000000 +0000 @@ -0,0 +1,1076 @@ +;;; button-lock.el --- Clickable text defined by regular expression +;; +;; Copyright (c) 2011-14 Roland Walker +;; +;; Author: Roland Walker +;; Homepage: http://github.com/rolandwalker/button-lock +;; URL: http://raw.githubusercontent.com/rolandwalker/button-lock/master/button-lock.el +;; Version: 1.0.0 +;; Last-Updated: 21 Oct 2013 +;; EmacsWiki: ButtonLockMode +;; Keywords: mouse, button, hypermedia, extensions +;; +;; Simplified BSD License +;; +;;; Commentary: +;; +;; Quickstart +;; +;; (require 'button-lock) +;; +;; (global-button-lock-mode 1) +;; +;; (setq url-button (button-lock-set-button +;; "\\ +;; +;; buttons.el +;; Miles Bader +;; +;; Notes +;; +;; By default, button-lock uses newfangled left-clicks rather than +;; Emacs-traditional middle clicks. +;; +;; Font lock is very efficient, but it is still possible to bog +;; things down if you feed it expensive regular expressions. Use +;; anchored expressions, and be careful about backtracking. See +;; `regexp-opt'. +;; +;; Some differences between button-lock.el and hi-lock.el: +;; +;; * The purpose of hi-lock.el is to change the _appearance_ +;; of keywords. The purpose of button-lock is to change the +;; _bindings_ on keywords. +;; +;; * Hi-lock also supports embedding new keywords in files, +;; which is too risky of an approach for button-lock. +;; +;; * Hi-lock supports overlays and can work without font-lock. +;; +;; Some differences between button-lock.el and buttons.el +;; +;; * Buttons.el is for inserting individually defined +;; buttons. Button-lock.el is for changing all matching text +;; into a button. +;; +;; Compatibility and Requirements +;; +;; GNU Emacs version 24.4-devel : yes, at the time of writing +;; GNU Emacs version 24.3 : yes +;; GNU Emacs version 23.3 : yes +;; GNU Emacs version 22.2 : yes, with some limitations +;; GNU Emacs version 21.x and lower : unknown +;; +;; No external dependencies +;; +;; Bugs +;; +;; Case-sensitivity of matches depends on how font-lock-defaults +;; was called for the current mode (setting +;; font-lock-keywords-case-fold-search). So, it is safest to +;; assume that button-lock pattern matches are case-sensitive -- +;; though they might not be. +;; +;; Return value for button-lock-register-global-button is inconsistent +;; with button-lock-set-button. The global function does not +;; return a button which could be later passed to +;; button-lock-extend-binding, nor are the arguments parsed and +;; checked for validity. Any errors for global buttons are also +;; deferred until the mode is activated. +;; +;; TODO +;; +;; Validate arguments to button-lock-register-global-button. +;; maybe split set-button into create/set functions, where +;; the create function does all validation and returns a +;; button object. Pass in button object to unset as well. +;; +;; Why are mouse and keyboard separate, can't mouse be passed +;; through kbd macro? The issue may have been just surrounding +;; mouse events with "<>" before passing to kbd. +;; +;; Look into new syntax-propertize-function variable (Emacs 24.x). +;; +;; A refresh function to toggle every buffer? +;; +;; Peek into font-lock-keywords and deduplicate based on the +;; stored patterns. +;; +;; Substitute a function for regexp to make properties invisible +;; unless button-lock mode is on - esp for keymaps. +;; +;; Add predicate argument to button-set where predicate is +;; evaluated during matcher. This could be used to test for +;; comment-only. +;; +;; Consider defining mode-wide button locks (pass the mode as the +;; first argument of font-lock-add-keywords). Could use functions +;; named eg button-lock-set-modal-button. +;; +;; Add a language-specific navigation library (header files in C, +;; etc). +;; +;; Example of exchanging text values on wheel event. +;; +;; Convenience parameters for right-click menus. +;; +;; Button-down visual effects as with Emacs widgets. +;; +;; License +;; +;; Simplified BSD License +;; +;; Copyright (c) 2011-12, Roland Walker +;; All rights reserved. +;; +;; Redistribution and use in source and binary forms, with or +;; without modification, are permitted provided that the following +;; conditions are met: +;; +;; 1. Redistributions of source code must retain the above +;; copyright notice, this list of conditions and the following +;; disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above +;; copyright notice, this list of conditions and the following +;; disclaimer in the documentation and/or other materials +;; provided with the distribution. +;; +;; Ths software is provided by Roland Walker "AS IS" and any express +;; or implied warranties, including, but not limited to, the implied +;; warranties of merchantability and fitness for a particular +;; purpose are disclaimed. In no event shall Roland Walker or +;; contributors be liable for any direct, indirect, incidental, +;; special, exemplary, or consequential damages (including, but not +;; limited to, procurement of substitute goods or services; loss of +;; use, data, or profits; or business interruption) however caused +;; and on any theory of liability, whether in contract, strict +;; liability, or tort (including negligence or otherwise) arising in +;; any way out of the use of this software, even if advised of the +;; possibility of such damage. +;; +;; The views and conclusions contained in the software and +;; documentation are those of the authors and should not be +;; interpreted as representing official policies, either expressed +;; or implied, of Roland Walker. +;; +;;; Change Log: +;; +;; 22 Aug 2012 +;; Rewrite. Incompatible changes: +;; +;; * `button-lock-pop-button' removed, replaced with the ability to +;; pass a button "object" to `button-lock-unset-button'. +;; +;; * `button-lock-unset-all-buttons' replaced by +;; `button-lock-clear-all-buttons'. +;; +;; * `button-lock-set-global-button' and `button-lock-unset-global-button' +;; replaced by `button-lock-register-global-button' and +;; `button-lock-unregister-global-button'. +;; +;; * `button-lock-unset-all-global-buttons' replaced by +;; `button-lock-unregister-all-global-buttons'. +;; +;; * `button-lock-pop-global-button' removed. +;; +;; * lighter variable name and content changed. +;; +;;; Code: +;; + +;;; requirements + +;; for callf, callf2, defun*, union +(require 'cl) + +(require 'font-lock) + +;;; customizable variables + +;;;###autoload +(defgroup button-lock nil + "Clickable text defined by regular expression." + :version "1.0.0" + :link '(emacs-commentary-link :tag "Commentary" "button-lock") + :link '(url-link :tag "GitHub" "http://github.com/rolandwalker/button-lock") + :link '(url-link :tag "EmacsWiki" "http://emacswiki.org/emacs/ButtonLockMode") + :prefix "button-lock-" + :group 'navigation + :group 'mouse + :group 'extensions) + +(defcustom button-lock-exclude-modes '( + fundamental-mode + Buffer-menu-mode + bm-show-mode + dired-mode + eshell-mode + gnus-article-mode + mime/viewer-mode + rmail-mode + term-mode + ) + "Modes for which global button-lock will not be activated. + +Modes may be excluded for reasons of security (since buttons can +execute arbitrary functions), efficiency, or to avoid conflicts +with modes that provide similar functionality." + :type '(repeat symbol) + :group 'button-lock) + +(defcustom button-lock-buffer-name-exclude-pattern "\\`[* ]" + "Do not activate minor made in buffers matching this regular expression. + +Buffers may be excluded for reasons of security (since buttons +can execute arbitrary functions), efficiency, or to avoid +conflicts with modes that provide similar functionality. + +The default pattern is designed to match buffers which are +programatically generated or internal to Emacs." + :type 'regexp + :group 'button-lock) + +(defcustom button-lock-buffer-include-functions '() + "Do not activate minor mode in a buffer unless all functions evaluate non-nil. + +Each function should take a single argument (a buffer). + +Set this value to nil to disable." + :type '(repeat function) + :group 'button-lock) + +(defcustom button-lock-buffer-exclude-functions '() + "Do not activate minor mode in a buffer if any function evaluates non-nil. + +Each function should take a single argument (a buffer). + +Set this value to nil to disable." + :type '(repeat function) + :group 'button-lock) + +(defcustom button-lock-mode-lighter " b-loc" + "This string appears in the mode-line when `button-lock-mode' is active. + +Set to nil or the empty string to disable the mode-line +lighter for `button-lock-mode'." + :type 'string + :group 'button-lock) +(put 'button-lock-mode-lighter 'risky-local-variable t) + +;;; faces + +(defface button-lock-button-face + '((t nil)) + "Face used to show active button-lock buttons. + +The default is for buttons to inherit whatever properties are +already provided by font-lock." + :group 'button-lock) + +(defface button-lock-mouse-face + '((t (:inherit highlight))) + "Face used to highlight button-lock buttons when the mouse hovers over." + :group 'button-lock) + +;;; variables + +(defvar button-lock-global-button-list nil + "Global button definitions added to every button-lock buffer. + +The form is a list of lists, each member being a set of arguments +to `button-lock-set-button'. + +This variable should be set by calling +`button-lock-register-global-button' and friends.") + +(defvar button-lock-button-list nil + "An internal variable used to keep track of button-lock buttons.") + +(defvar button-lock-mode nil + "Mode variable for `button-lock-mode'.") + +(make-variable-buffer-local 'button-lock-mode) +(make-variable-buffer-local 'button-lock-button-list) +(put 'button-lock-button-list 'permanent-local t) + +;;; macros + +(defmacro button-lock-called-interactively-p (&optional kind) + "A backward-compatible version of `called-interactively-p'. + +Optional KIND is as documented at `called-interactively-p' +in GNU Emacs 24.1 or higher." + (cond + ((not (fboundp 'called-interactively-p)) + '(interactive-p)) + ((condition-case nil + (progn (called-interactively-p 'any) t) + (error nil)) + `(called-interactively-p ,kind)) + (t + '(called-interactively-p)))) + +;;; compatibility functions + +;; string-match-p is new in 23.x and above +(unless (fboundp 'string-match-p) + (defsubst string-match-p (regexp string &optional start) + "Same as `string-match' except this function does not change the match data." + (let ((inhibit-changing-match-data t)) + (string-match regexp string start)))) + +;;; utility functions + +;; buffer functions + +(defun button-lock-buffer-included-p (buf) + "Return BUF if global button-lock should enable button-lock in BUF." + (when (and (not noninteractive) + (bufferp buf) + (buffer-name buf)) + (with-current-buffer buf + (when (and (not (minibufferp buf)) + (not (eq (aref (buffer-name) 0) ?\s)) ; overlaps with exclude-pattern + (not (memq major-mode button-lock-exclude-modes)) + (not (string-match-p button-lock-buffer-name-exclude-pattern (buffer-name buf))) + (catch 'success + (dolist (filt button-lock-buffer-exclude-functions) + (when (funcall filt buf) + (throw 'success nil))) + t) + (catch 'failure + (dolist (filt button-lock-buffer-include-functions) + (unless (funcall filt buf) + (throw 'failure nil))) + t)) + buf)))) + +(defun button-lock-maybe-unbuttonify-buffer () + "This is a workaround for cperl mode, which clobbers `font-lock-unfontify-region-function'." + (when (and (boundp 'font-lock-fontified) + font-lock-fontified + (not (eq font-lock-unfontify-region-function 'font-lock-default-unfontify-region))) + (font-lock-default-unfontify-region (point-min) (point-max)))) + +(defun button-lock-maybe-fontify-buffer () + "Fontify, but only if font-lock is already on. + +This is to avoid turning on font-lock if we are in the process of +disabling button-lock." + (when (and (boundp 'font-lock-fontified) + font-lock-fontified) + (font-lock-fontify-buffer))) + +;; button functions + +;;;###autoload +(defun button-lock-button-properties (button) + "Return list of properties for BUTTON." + (when (listp button) + (cadr (cadr (cadr button))))) + +;;;###autoload +(defun button-lock-button-p (button) + "Return t if BUTTON is a button-lock button." + (ignore-errors + (car (memq 'button-lock (button-lock-button-properties button))))) + +;;;###autoload +(defun button-lock-button-pattern (button) + "Return pattern for BUTTON." + (when (listp button) + (car button))) + +;;;###autoload +(defun button-lock-button-grouping (button) + "Return grouping for BUTTON." + (when (listp button) + (car (cadr button)))) + +;;;###autoload +(defun button-lock-find-extent (&optional pos property) + "Find the extent of a button-lock property around some point. + +POS defaults to the current point. PROPERTY defaults to +'button-lock. + +Returns a cons in the form (START . END), or nil if there +is no such PROPERTY around POS." + (callf or pos (point)) + (callf or property 'button-lock) + (when (get-text-property pos property) + (cons (if (and (> pos (point-min)) (get-text-property (1- pos) property)) (previous-single-property-change pos property) pos) + (next-single-property-change pos property)))) + +;; font-lock functions + +(defun button-lock-tell-font-lock (&optional forget) + "Tell `font-lock-keywords' about the buttons in `button-lock-button-list'. + +When FORGET is set, tell `font-lock-keywords' to forget about +the buttons in `button-lock-button-list', as well as any other +keywords with the 'button-lock property." + (if forget + (let ((keywords (copy-tree font-lock-keywords))) + (when (eq t (car keywords)) + ;; get uncompiled keywords + (setq keywords (cadr keywords))) + (dolist (kw (union keywords button-lock-button-list)) + (when (button-lock-button-p kw) + (font-lock-remove-keywords nil (list kw))))) + (unless button-lock-mode + (error "Button-lock mode is not in effect")) + (dolist (button button-lock-button-list) + (font-lock-remove-keywords nil (list button)) + (font-lock-add-keywords nil (list button))))) + +(defun button-lock-do-tell () + "Run `button-lock-tell-font-lock' appropriately in hooks." + (when button-lock-mode + (if font-lock-mode + (button-lock-tell-font-lock) + (button-lock-tell-font-lock 'forget)))) + +;; internal driver for local buttons + +(defun button-lock-remove-from-button-list (button) + "Remove BUTTON from `button-lock-button-list' and `font-lock-keywords'." + (when button-lock-mode + (font-lock-remove-keywords nil (list button)) + (button-lock-maybe-unbuttonify-buffer) ; cperl-mode workaround + (button-lock-maybe-fontify-buffer)) + (callf2 delete button button-lock-button-list) + nil) + +(defun button-lock-add-to-button-list (button &optional no-replace) + "Add BUTTON to `button-lock-button-list' and `font-lock-keywords'. + +The regexp used by the button is checked against the existing +data structure. If the regexp duplicates that of an existing button, +the existing duplicate is replaced. + +If NO-REPLACE is set, no replacement is made for a duplicate button." + (let ((conflict (catch 'hit + (dolist (b button-lock-button-list) + (when (equal (car b) (car button)) + (throw 'hit b)))))) + (if (and conflict no-replace) + conflict + (when (and conflict (not no-replace)) + (button-lock-remove-from-button-list conflict)) + (add-to-list 'button-lock-button-list button) + (when button-lock-mode + (font-lock-add-keywords nil (list button)) + (button-lock-maybe-fontify-buffer)) + button))) + +;; internal driver for global buttons + +(defun button-lock-remove-from-global-button-list (button) + "Remove BUTTON from `button-lock-global-button-list'." + (callf2 delete button button-lock-global-button-list)) + +(defun button-lock-add-to-global-button-list (button &optional no-replace) + "Add BUTTON to `button-lock-global-button-list'. + +The regexp used by the button is checked against the existing +data structure. If the regexp duplicates that of an existing button, +the existing duplicate is replaced. + +If NO-REPLACE is set, no replacement is made for a duplicate button." + (let ((conflict (catch 'hit + (dolist (b button-lock-global-button-list) + (when (equal (car b) (car button)) + (throw 'hit b)))))) + (unless (and conflict no-replace) + (when (and conflict (not no-replace)) + (button-lock-remove-from-global-button-list conflict)) + (add-to-list 'button-lock-global-button-list button)))) + +(defun button-lock-merge-global-buttons-to-local () + "Add predefined, non-conflicting global buttons to the local list." + (dolist (button button-lock-global-button-list) + (unless (member button button-lock-button-list) + (apply 'button-lock-set-button (append button '(:no-replace t)))))) + +;;; minor-mode definition + +;;;###autoload +(define-minor-mode button-lock-mode + "Toggle button-lock-mode, a minor mode for making text clickable. + +Button-lock uses `font-lock-mode' to create and maintain its text +properties. Therefore this mode can only be used where +`font-lock-mode' is active. + +`button-lock-set-button' may be called to create a new button. +`button-lock-clear-all-buttons' may be called to clear all button +definitions in a buffer. + +When called interactively with no prefix argument, this command +toggles the mode. When called interactively, with a prefix +argument, it enables the mode if the argument is positive and +otherwise disables it. When called from Lisp, it enables the +mode if the argument is omitted or nil, and toggles the mode if +the argument is 'toggle." + nil button-lock-mode-lighter nil + (cond + ((and button-lock-mode + (or noninteractive ; never turn on button-lock where + (eq (aref (buffer-name) 0) ?\s))) ; there can be no font-lock + (setq button-lock-mode nil)) + (button-lock-mode + (font-lock-mode 1) + (button-lock-merge-global-buttons-to-local) + (add-hook 'font-lock-mode-hook 'button-lock-do-tell nil t) + (button-lock-tell-font-lock) + (button-lock-maybe-fontify-buffer) + (when (button-lock-called-interactively-p 'interactive) + (message "button-lock mode enabled"))) + (t + (button-lock-tell-font-lock 'forget) + (button-lock-maybe-unbuttonify-buffer) ; cperl-mode workaround + (button-lock-maybe-fontify-buffer) + (when (button-lock-called-interactively-p 'interactive) + (message "button-lock mode disabled"))))) + +;;; global minor-mode definition + +(defun button-lock-maybe-turn-on (&optional arg) + "Activate `button-lock-mode' in a buffer if appropriate. + +button-lock mode will be activated in every buffer, except + + minibuffers + buffers with names that begin with space + buffers excluded by `button-lock-exclude-modes' + buffers excluded by `button-lock-buffer-name-exclude-pattern' + +If called with a negative ARG, deactivate button-lock mode in the +buffer." + (callf or arg 1) + (when (or (< arg 0) + (button-lock-buffer-included-p (current-buffer))) + (button-lock-mode arg))) + +;;;###autoload +(define-globalized-minor-mode global-button-lock-mode button-lock-mode button-lock-maybe-turn-on + :group 'button-lock) + +;;; principal external interface + +;;;###autoload +(defun* button-lock-set-button (pattern action &key + + (face 'button-lock-face) + (mouse-face 'button-lock-mouse-face) + (face-policy 'append) + help-echo + help-text + kbd-help + kbd-help-multiline + + (grouping 0) + + (mouse-binding 'mouse-1) + keyboard-binding + keyboard-action + additional-property + rear-sticky + + remove + no-replace + + mouse-2 + mouse-3 + mouse-4 + mouse-5 + wheel-down + wheel-up + + down-mouse-1 + down-mouse-2 + down-mouse-3 + down-mouse-4 + down-mouse-5 + + double-mouse-1 + double-mouse-2 + double-mouse-3 + double-mouse-4 + double-mouse-5 + + triple-mouse-1 + triple-mouse-2 + triple-mouse-3 + triple-mouse-4 + triple-mouse-5 + + A-mouse-1 + A-mouse-2 + A-mouse-3 + A-mouse-4 + A-mouse-5 + A-wheel-down + A-wheel-up + + C-mouse-1 + C-mouse-2 + C-mouse-3 + C-mouse-4 + C-mouse-5 + C-wheel-down + C-wheel-up + + M-mouse-1 + M-mouse-2 + M-mouse-3 + M-mouse-4 + M-mouse-5 + M-wheel-down + M-wheel-up + + S-mouse-1 + S-mouse-2 + S-mouse-3 + S-mouse-4 + S-mouse-5 + S-wheel-down + S-wheel-up + + s-mouse-1 + s-mouse-2 + s-mouse-3 + s-mouse-4 + s-mouse-5 + s-wheel-down + s-wheel-up) + +"Attach mouse actions to text via `font-lock-mode'. + +Required argument PATTERN is a regular expression to match. + +Required argument ACTION is a function to call when the matching +text is clicked. A quoted function name or a lambda expression +may be given. The function called by ACTION must be interactive. +If ACTION is not valid the user may experience a silent failure. + +If the function called by ACTION uses (interactive \"e\") it may +receive the relevant mouse event. Note that you may wish to use +the mouse event to reposition the point. + +ACTION may alternatively contain a prepared keymap, in which case +the convenience parameters :MOUSE-BINDING, :KEYBOARD-BINDING, +and :KEYBOARD-ACTION will be ignored. + +Following PATTERN and ACTION is a Common Lisp-style series of +keyword/value arguments: + +Setting :NO-REPLACE causes the function to have no effect when +a button already exists using the given PATTERN. By default, +any existing button using PATTERN will be replaced. + +:FACE is a font face to set on matching text, like hi-lock mode. +By default, :FACE has no properties, and :FACE-POLICY is :APPEND. +This means that other, existing text properties will take +priority, and that clickable text will not be distinguished +without a mouseover. To change this, try adding the arguments +\":face 'link :face-policy 'prepend.\" Alternatively, +`button-lock-face' may be customized. + +:MOUSE-FACE is the font face to set on mouseovers. It defaults +to `button-lock-mouse-face'. + +:FACE-POLICY sets the override policy for button faces. Useful +values are nil, 'keep, 'prepend, and 'append (the default). See +the documentation for OVERRIDE in `font-lock-keywords'. + +:HELP-ECHO is applied to the 'help-echo text property, and may +become visible in a tooltip depending on your Emacs setup. +:HELP-TEXT is a deprecated synonym. + +:KBD-HELP is applied to the 'kbd-help text property, accessible +to the user via `display-local-help', + +:KBD-HELP-MULTILINE is applied to the non-standard +'kbd-help-multiline text property. + +:GROUPING designates a subgroup in the pattern match to receive +the new text properties. Subgroups, delimited by parentheses, +are numbered from 1. The default :GROUPING is 0, indicating the +entire match. + +:MOUSE-BINDING sets the mouse event which will invoke ACTION. +The default is 'mouse-1. + +:KEYBOARD-BINDING sets a keyboard event which will invoke ACTION. +The format is as accepted by `kbd'. The default is nil, meaning +no keyboard binding is in effect. If this is set, it might also +be wise to alert the user by setting :FACE. Note, the only +difference between :MOUSE-BINDING and :KEYBOARD-BINDING is +that :KEYBOARD-BINDING is interpreted by `kbd'. It is possible +to pass keyboard events into :MOUSE-BINDING and vice versa. + +:KEYBOARD-ACTION is an alternate event to be run by +:KEYBOARD-BINDING. The default is nil, meaning that +:KEYBOARD-BINDING will invoke ACTION. This is intended for cases +where ACTION is dependent on the position of the mouse. + +:ADDITIONAL-PROPERTY defines an arbitrary text property which +will be set to t in for text which matches PATTERN, as optionally +modified by :GROUPING. The property 'button-lock will always be +set. + +As a convenience, :MOUSE-2 through :MOUSE-5 can be used to attach +an alternate ACTION, as can :M-MOUSE-1 ..., :A-MOUSE-1 ..., +:DOUBLE-MOUSE-1 ..., :WHEEL-UP..., and :WHEEL-DOWN... The list is not +exhaustive. For a general method of adding alternate bindings, pass +a keymap for :ACTION or use `button-lock-extend-binding'. + +If :REAR-STICKY is non-nil, the rear-nonsticky text property will +not be added, as it is by default. Changing this setting is not +recommended. + +If :REMOVE is non-nil, any existing button using PATTERN will +be removed and forgotten by font-lock. + +If successful, this function returns the button which was added +or removed from `font-lock-keywords'. Otherwise it returns nil. +The button value can be passed to `button-lock-extend-binding'." + + (let ((map (make-sparse-keymap)) + (properties nil) + (fl-keyword nil)) + + (if (keymapp action) + (setq map (copy-sequence action)) + + ;; else + (define-key map `[,mouse-binding] action) + + (dolist (var '( + mouse-2 + mouse-3 + mouse-4 + mouse-5 + wheel-down + wheel-up + + down-mouse-1 + down-mouse-2 + down-mouse-3 + down-mouse-4 + down-mouse-5 + + double-mouse-1 + double-mouse-2 + double-mouse-3 + double-mouse-4 + double-mouse-5 + + triple-mouse-1 + triple-mouse-2 + triple-mouse-3 + triple-mouse-4 + triple-mouse-5 + + A-mouse-1 + A-mouse-2 + A-mouse-3 + A-mouse-4 + A-mouse-5 + A-wheel-down + A-wheel-up + + C-mouse-1 + C-mouse-2 + C-mouse-3 + C-mouse-4 + C-mouse-5 + C-wheel-down + C-wheel-up + + M-mouse-1 + M-mouse-2 + M-mouse-3 + M-mouse-4 + M-mouse-5 + M-wheel-down + M-wheel-up + + S-mouse-1 + S-mouse-2 + S-mouse-3 + S-mouse-4 + S-mouse-5 + S-wheel-down + S-wheel-up + + s-mouse-1 + s-mouse-2 + s-mouse-3 + s-mouse-4 + s-mouse-5 + s-wheel-down + s-wheel-up)) + + (when (symbol-value var) + (define-key map `[,var] (symbol-value var)))) + + (when keyboard-binding + (define-key map (read-kbd-macro keyboard-binding) (or keyboard-action action)))) + + (setq properties `(face ,face keymap ,map button-lock t)) + (add-to-list 'font-lock-extra-managed-props 'keymap) + (add-to-list 'font-lock-extra-managed-props 'button-lock) + + (when additional-property + (callf append properties `(,additional-property t)) + (add-to-list 'font-lock-extra-managed-props additional-property)) + + (when mouse-face + (callf append properties `(mouse-face ,mouse-face)) + (add-to-list 'font-lock-extra-managed-props 'mouse-face)) + + (when (or help-echo help-text) + (callf append properties `(help-echo ,(or help-echo help-text))) + (add-to-list 'font-lock-extra-managed-props 'help-echo)) + + (when kbd-help + (callf append properties `(kbd-help ,kbd-help)) + (add-to-list 'font-lock-extra-managed-props 'kbd-help)) + + (when kbd-help-multiline + (callf append properties `(kbd-help-multiline ,kbd-help-multiline)) + (add-to-list 'font-lock-extra-managed-props 'kbd-help-multiline)) + + (unless rear-sticky + (callf append properties `(rear-nonsticky t)) + (add-to-list 'font-lock-extra-managed-props 'rear-nonsticky)) + + (setq fl-keyword `(,pattern (,grouping ',properties ,face-policy))) + + (if remove + (button-lock-remove-from-button-list fl-keyword) + (button-lock-add-to-button-list fl-keyword no-replace)))) + +;;;###autoload +(defun button-lock-unset-button (&rest button) + "Equivalent to running `button-lock-set-button' with :REMOVE set to true. + +The syntax is otherwise identical to `button-lock-set-button', +which see. + +A single argument BUTTON object may also be passed, which was returned +from `button-lock-set-button'." + (if (and (= 1 (length button)) + (button-lock-button-p (car button))) + (button-lock-remove-from-button-list (car button)) + (apply 'button-lock-set-button (append button '(:remove t))))) + +;;;###autoload +(defun button-lock-extend-binding (existing-button action mouse-binding &optional keyboard-binding) + "Add a binding to an existing button. + +The principal button creation function `button-lock-set-button' +accepts only a limited subset of mouse bindings when binding +multiple actions. This function supports arbitrary key bindings +for binding additional actions on a button. + +EXISTING-BUTTON is a button value as returned by +`button-lock-set-button'. + +ACTION, MOUSE-BINDING and KEYBOARD-BINDING are as documented in +`button-lock-set-button'. It is possible to pass a nil +MOUSE-BINDING in order to set only a KEYBOARD-BINDING. + +When passing a prepared keymap for ACTION, set MOUSE-BINDING +to nil." + (when (not (member existing-button button-lock-button-list)) + (error "No such button")) + (let ((map (cadr (memq 'keymap (button-lock-button-properties (car (member existing-button button-lock-button-list))))))) + (when button-lock-mode + (font-lock-remove-keywords nil (list existing-button))) + (if (keymapp action) + (dolist (cell (cdr action)) + (define-key map (vector (car cell)) (cdr cell))) + ;; else + (when mouse-binding + (define-key map `[,mouse-binding] action)) + (when keyboard-binding + (define-key map (read-kbd-macro keyboard-binding) action))) + (when button-lock-mode + (font-lock-add-keywords nil (list existing-button))))) + +;;;###autoload +(defun button-lock-clear-all-buttons () + "Remove and deactivate all button-lock buttons in the buffer. + +If FORCE is non-nil, try to remove buttons even when the minor +mode is not active." + (interactive) + (let ((num (length button-lock-button-list))) + (button-lock-tell-font-lock 'forget) + (setq button-lock-button-list nil) + (button-lock-maybe-unbuttonify-buffer) ; cperl-mode workaround + (button-lock-maybe-fontify-buffer) + (when (and + (button-lock-called-interactively-p 'interactive) + (> num 0)) + (message "removed %d button patterns" num)) + num)) + +;;;###autoload +(defun button-lock-register-global-button (&rest button) + "Register a global button-lock button definition. + +Arguments follow the form of `button-lock-set-button'. + +The BUTTON defined here will applied each time the button-lock +minor mode is activated in a buffer. + +To see an effect in any given buffer, button-lock mode must be +deactivated and reactivated." + (button-lock-add-to-global-button-list button)) + +;;;###autoload +(defun button-lock-unregister-global-button (&rest button) + "Remove global button-lock BUTTON. + +Arguments follow the form of `button-lock-set-button'. + +To see an effect in any given buffer, button-lock mode must be +deactivated and reactivated." + (button-lock-remove-from-global-button-list button)) + +;;;###autoload +(defun button-lock-unregister-all-global-buttons () + "Remove all global button-lock buttons definitions. + +To see an effect in any given buffer, button-lock mode must be +deactivated and reactivated." + (interactive) + (setq button-lock-global-button-list nil) + t) + +(provide 'button-lock) + +;; +;; Emacs +;; +;; Local Variables: +;; indent-tabs-mode: nil +;; mangle-whitespace: t +;; require-final-newline: t +;; coding: utf-8 +;; byte-compile-warnings: (not cl-functions redefine) +;; End: +;; +;; LocalWords: ButtonLockMode mouseable mybutton keymap propertize +;; LocalWords: callf cperl nonsticky setq fixmee devel uncompiled +;; LocalWords: MULTILINE multiline Koppelman Bader +;; + +;;; button-lock.el ends here diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/dict.el emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/dict.el --- emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/dict.el 2015-06-14 19:01:24.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/dict.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,633 +0,0 @@ -;; dict.el --- Emacs interface to dict client -;; -;; $Id: dict.el,v 1.7 2013/12/04 22:32:10 psg Exp $ -;; - -;; Copyright (c) 2002, 2003, 2004 Max Vasin -;; -;; This program 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 -;; of the License, or (at your option) any later version. -;; -;; This program 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 this program; if not, write to the Free Software Foundation, Inc., -;; 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - -;;; Commentary -;; -;; dict.el is an Emacs wrapper around `dict' command to provide an easy and -;; comfortable (from my point of view) access to the dictd server from the Emacs. -;; The package was written and tested under GNU Emacs 21 only but I hope it should -;; work under other Emacs versions as well. dict.el depends on bash or compatible shell -;; (I haven't tested it with other shells), cut, sed, awk, and dict. A coding convertion -;; program can be used to use automatic recoding thus allowing databases in different -;; codings. -;; -;; The package provides several key bindings, which are customisation variables, -;; so you can change them easily without recompiling the package: -;; 1. `C-c d d' for running dict with options defined by customisation -;; variables described below. -;; 2. `C-c d r' for running dict on region as a single word. -;; 3. `C-c d m' for running dict on every word in the region. -;; 4. `C-c d s' for running dict to perform search on the given server. -;; 5. `C-c d S' to view similar words for the last dict run. -;; -;; Descriptions of all customisation variables are given below in their -;; definitions, and of cause you can find them in the customisation buffer -;; (External->Dict). -;; -;; I hope you find the program usefull. And also I would like to know your -;; opinion about the program, improvement suggestions and of cause bug reports. -;; Mail them to - -;;; Code: - -(require 'cl) - -(defgroup Dict nil - "Browse DICT dictionaries." - :prefix "dict-" - :group 'external) - -;;;; -;;;; Definitions of dict client parameter variables -;;;; - -(defcustom dict-servers '("dict.org" "alt0.dict.org" "alt1.dict.org" "alt2.dict.org") - "Specifies the hostname for the DICT server. -If IP lookup for a server expands to a list of IP addresses (as dict.org -does currently), then each IP will be tried in the order listed." - :type '(repeat (string :tag "Server name")) - :group 'Dict) - -;; Forward declarations -(defcustom dict-databases nil - "Foo." - :type 'string - :group 'Dict) - -(defcustom dict-strategies nil - "Bar." - :type 'string - :group 'Dict) - -(defcustom dict-service "" - "Specifies the port or service for connections. -The default is 2628, as specified in the DICT Protocol -RFC." - :type 'string - :group 'Dict) - -(defcustom dict-match nil - "Instead of printing a definition, perform a match using the specified strategy." - :type 'boolean - :group 'Dict) - -(defcustom dict-nocorrect nil - "Disable spelling correction. -Usually, if a definition is requested and the word cannot be found, -spelling correction is requested from the server, and a list of -possible words are provided. This option disables the generation of -this list." - :type 'boolean - :group 'Dict) - -(defcustom dict-noauth nil - "Disable authentication (i.e., don't send an AUTH command)." - :type 'boolean - :group 'Dict) - -(defcustom dict-user "" - "Specifies the username for authentication." - :type 'string - :group 'Dict) - -(defcustom dict-key "" - "Specifies the shared secret for authentication." - :type 'string - :group 'Dict) - -(defcustom dict-pipesize 256 - "Specify the buffer size for pipelineing commands. -The default is 256, which should be sufficient for general tasks and -be below the MTU for most transport media. Larger values may provide -faster or slower throughput, depending on MTU. If the buffer is too -small, requests will be serialised. Values less than 0 and greater -than one million are silently changed to something more reasonable." - :type 'integer - :group 'Dict) - -(defcustom dict-original-server "" - "Specifies original server name for the `dict-on-server' function." - :type 'string - :group 'Dict) - -(defcustom dict-client "" - "Specifies additional text to be sent using the CLIENT command." - :type 'string - :group 'Dict) - -(defcustom dict-always-quote-terms nil - "If t dict.el will always quote terms." - :type 'boolean - :group 'Dict) - -(defcustom dict-show-one-window nil - "If t dict.el will show one window (i.e. without splitting)." - :type 'boolean - :group 'Dict) - -(defcustom dict-character-recoding-map nil - "Specifies recoding command for given dictionary." - :tag "DICT Character Recoding Map" - :type '(repeat (list :tag "Dict servers" - (string :tag "Server name") - (repeat :tag "Database recoding mappings" - (list :tag "Database" - (regexp :tag "Database name") - (string :tag "Recoding command"))))) - :group 'Dict) - -;;;; -;;;; Key binding customisation variables and helper functions -;;;; - -(defun dict-set-key-binding (key value) - "Stub for setting KEY binding to VALUE." - (set-default key value)) - -(defun dict-set-enable-key-bindings (key value) - "Stub for setting KEY binding to VALUE." - (set-default key value)) - -(defun dict-mode-set-key-binding (key value) - "Stub for setting KEY binding to VALUE." - (set-default key value)) - -(defcustom dict-enable-key-bindings nil - "Enables key bindings for dict.el commands." - :type 'boolean - :group 'Dict - :set 'dict-set-enable-key-bindings - :require 'dict) - -(defcustom dict-key-binding "\\C-cdd" - "Specifies a key binding to run dict and display the results in the Emacs buffer." - :type 'string - :group 'Dict - :set 'dict-set-key-binding - :require 'dict) - -(defcustom dict-region-key-binding "\\C-cdr" - "Specifies a key binding to run dict on the region and display the results in the Emacs buffer." - :type 'string - :group 'Dict - :set 'dict-set-key-binding - :require 'dict) - -(defcustom dict-multiple-key-binding "\\C-cdm" - "Run dict on region. -Specifies a key binding to run dict on every word from the region -and display the results in the Emacs buffer." - :type 'string - :group 'Dict - :set 'dict-set-key-binding - :require 'dict) - -(defcustom dict-on-server-key-binding "\\C-cds" - "Run dict on server. -Specifies a key binding to run dict to search word on the given -server and display the results in the Emacs buffer." - :type 'string - :group 'Dict - :set 'dict-set-key-binding - :require 'dict) - -(defcustom dict-similar-words-key-binding "\\C-cdS" - "Specifies a key binding to show similar words." - :tag "Show similar words" - :type 'string - :group 'Dict-Mode - :set 'dict-set-key-binding - :require 'dict) - -(defgroup Dict-Mode nil - "DICT-mode key bindings" - :tag "DICT-mode" - :prefix "dict-mode-" - :group 'Dict) - -(defcustom dict-mode-key-binding "d" - "Specifies a key binding to run dict and display the results in the Emacs buffer." - :tag "DICT" - :type 'string - :group 'Dict-Mode - :set 'dict-mode-set-key-binding - :require 'dict) - -(defcustom dict-mode-region-key-binding "r" - "Specifies a key binding to run dict on the region and display the results in the Emacs buffer." - :tag "DICT region" - :type 'string - :group 'Dict-Mode - :set 'dict-mode-set-key-binding - :require 'dict) - -(defcustom dict-mode-multiple-key-binding "m" - "Run dict on every word in region. -Specifies a key binding to run dict on every word from the region and -display the results in the Emacs buffer." - :tag "DICT multiple" - :type 'string - :group 'Dict-Mode - :set 'dict-mode-set-key-binding - :require 'dict) - -(defcustom dict-mode-on-server-key-binding "s" - "Specifies a key binding to run dict to search word on the given server and display the results in the Emacs buffer." - :tag "DICT on server" - :type 'string - :group 'Dict-Mode - :set 'dict-mode-set-key-binding - :require 'dict) - -(defcustom dict-mode-similar-words-key-binding "S" - "Specifies a key binding to show similar words." - :tag "Show similar words" - :type 'string - :group 'Dict-Mode - :set 'dict-mode-set-key-binding - :require 'dict) - -(defcustom dict-buffer-coding-system nil - "Specifies coding system to use in dict buffer." - :tag "Input coding system for DICT buffer" - :type 'string - :group 'Dict-Mode) - -(defvar dict-similar-buffer nil) - -;;;; -;;;; Service functions -;;;; - -(defun dict-get-databases (host) - "Get a list of available databases." - (let* ((dbinfo-string (shell-command-to-string (format "dict -h %s -D 2> /dev/null | awk 'BEGIN { print \"(\"; } \ -/^[ ]+/ { match($0, /^[ ]+([a-z0-9]+)[ ]+(.+)/, r); print \"(\\\"\" r[1] \"\\\"\" \" \\\"\" r[2]\"\\\")\"; } \ -END { print \")\" }'" host))) - (dbinfo (read dbinfo-string)) - (dbnames (mapcar 'car dbinfo)) - (dbdecss (mapcar 'cadr dbinfo))) - `(,dbnames ,dbdecss))) - -(defun dict-get-strategies (host) - "Get a list of strategies." - (let* ((stratsinfo-string (shell-command-to-string (format "dict -h %s -S 2> /dev/null | awk 'BEGIN { print \"(\"; } \ -/^[ ]+/ { match($0, /^[ ]+([a-z0-9]+)[ ]+(.+)/, r); print \"(\\\"\" r[1] \"\\\"\" \" \\\"\" r[2]\"\\\")\"; } \ -END { print \")\" }'" host))) - (stratsinfo (read stratsinfo-string)) - (stnames (mapcar 'car stratsinfo)) - (stdecss (mapcar 'cadr stratsinfo))) - `(,stnames ,stdecss))) - -(defun dict-generate-constant (value tag) - "Generate constant for customisation type of VALUE with TAG." - `(const :tag ,tag ,value)) - -(defun dict-get-database-names (host) - "Get a list of available database names." - (mapcar 'symbol-name - (read (concat "(" (shell-command-to-string - (format "dict -h %s -D 2> /dev/null | cut -f 2 -d ' ' | sed -e '1 d'" host host)) ")")))) - -(defcustom dict-strategies (mapcar (lambda (h) (list h nil)) dict-servers) - "Specify a matching strategy. -By default, the server default match strategy is used. This is -usually \"exact\" for definitions, and some form of -spelling-correction strategy for matches (\".\" fromthe DICT -protocol). The available strategies are dependent on the server -implemenation." - :type `(list :tag "Server" ,@(mapcar - (lambda (h) - `(list (const ,h) - (choice :tag "Strategies" ,@(apply 'mapcar* 'dict-generate-constant (dict-get-strategies h)) - (const :tag "default" nil)))) - dict-servers)) - :group 'Dict) - -(defcustom dict-databases (mapcar (lambda (h) (list h (dict-get-database-names h))) dict-servers) - "Specifies a specific database to search. -The default is to search all databases (a * from the DICT -protocol). Note that a ! in the DICT protocol means to search all of -the databases until a match is found, and then stop searching." - :type `(list :tag "Server" ,@(mapcar - (lambda (h) - `(list (const ,h) - (set :tag "Databases" ,@(apply 'mapcar* 'dict-generate-constant - (dict-get-databases h))))) - dict-servers)) - :group 'Dict) - -(defun dict-generate-options-list (prefix seq) - "Generate a list of options of the form `PREFIX SEQ[0] PREFIX SEQ[1] ...'." - (if (null seq) - "" - (concat prefix (car seq) (dict-generate-options-list prefix (cdr seq))))) - -(defsubst dict-nes (string) - "T if STRING is not empty." - (not (string= string ""))) - -(defun dict-generate-options (database host) - "Generate dict's command line options based on the parameter variables' values, DATABASE and HOST" - (concat - (if (dict-nes dict-service) (concat " --port " dict-service) "") - (if dict-match " --match" "") - (if (cadr (assoc host dict-strategies)) (concat " --strategy " (cadr (assoc host dict-strategies)) "")) - (if dict-nocorrect " --nocorrect ") - (if dict-noauth " --noauth" "") - (if (dict-nes dict-user) (concat " --user " dict-user) "") - (if (dict-nes dict-key) (concat " --key " dict-key) "") - (if (not (= dict-pipesize 256)) (concat " --pipesize " (number-to-string dict-pipesize)) "") - (if (dict-nes dict-client) (concat " --client " dict-client) "") - (concat " --database " database) - (concat " --host " host) - " --pager -" ; force dict to not use pager - " ")) - -(defun dict-newline-to-space (string) - "Replace newline with space in STRING." - (let ((result (make-string (length string) ?x))) - (dotimes (i (length string) 1) - (aset result i (if (char-equal (aref string i) ?\n) ?\ (aref string i)))) - result)) - -(defun dict-reduce-spaces (string) - "Replace multiple sequencial whitespaces in STRING with one whitespace." - (if (not (string-match "[ \t][ \t]+" string)) - string - (dict-reduce-spaces (replace-match " " t "\\&" string nil)))) - -(defsubst dict-normalise-request (request) - "Replace newlines and multiple spaces with one space in the REQUEST." - (dict-reduce-spaces (dict-newline-to-space request))) - -(defun dict-quote (word) - "Quote WORD if necessary." - (if dict-always-quote-terms - (if (or (and (eq (aref word 0) ?\") - (eq (aref word (- (length word) 1)) ?\")) - (and (eq (aref word 0) ?\') - (eq (aref word (- (length word) 1)) ?\'))) - word - (concat "'" word "'")) - word)) - -(defun dict-generate-command (word database host) - "Generate dict command to search in the given DATABASE and HOST." - (let ((recoding-command (or - (cadr (assoc database (cadr (assoc host dict-character-recoding-map)))) - (cadr (assoc "*" (cadr (assoc host dict-character-recoding-map))))))) - (if recoding-command - (format "dict %s %s | %s" (dict-generate-options database host) (dict-quote word) recoding-command) - (format "dict %s %s" (dict-generate-options database host) (dict-quote word))))) - -(defun dict-get-answer (what) - "Recieve the answer for WHAT from the dict and insert in ther buffer." - (let* ((word (dict-normalise-request what)) - (buffer-name (concat "*DICT " word "*")) - (similar-buffer-name (concat "*DICT " word " (similar) *")) - (buffer (or (get-buffer buffer-name) (generate-new-buffer buffer-name))) - (similar-buffer (or (get-buffer similar-buffer-name) (generate-new-buffer similar-buffer-name))) - (coding-system-for-read dict-buffer-coding-system) - (coding-system-for-write dict-buffer-coding-system)) - (setq dict-similar-buffer similar-buffer) - (save-current-buffer - (set-buffer similar-buffer) - (kill-region (point-min) (point-max)) - (set-buffer buffer) - (kill-region (point-min) (point-max)) - (make-local-variable 'dict-similar-buffer) - (setq dict-similar-buffer similar-buffer) - (dict-mode)) - (message "Invoking dict %s in the background" word) - (mapcar (lambda (host) - (mapcar (lambda (database) - (set-process-sentinel - (start-process "dict" (generate-new-buffer "dict") "sh" "-c" - (dict-generate-command word database host)) - (dict-make-sentinel-with-buffer buffer))) - (if (cadr (assoc host dict-databases)) (cadr (assoc host dict-databases)) - (dict-get-database-names host)))) - dict-servers))) - -(defun dict-add-result-to-buffer (result-buffer output-buffer) - "Add dict's answer from RESULT-BUFFER to OUTPUT-BUFFER." - ;; Preformat data in the result buffer - (set-buffer result-buffer) - (goto-char (point-min)) - (kill-line 2) - - ;; Insert answer into the output buffer - (set-buffer output-buffer) - (goto-char (point-max)) - (insert-buffer-substring result-buffer) - (kill-buffer result-buffer) - (goto-char (point-min)) - (display-buffer output-buffer) - (when dict-show-one-window - (switch-to-buffer output-buffer) - (delete-other-windows))) - -(defun dict-get-error-message (string) - "Returns error message, cutting ', perhaps you mean:' from the STRING." - (if (char-equal (elt string (- (length string) 1)) ?:) - (substring string 0 (- (length string) (length ", perhaps you mean:"))) - string)) - -(defun dict-make-sentinel-with-buffer (buffer) - "Make process sentinel to write result to BUFFER." - (lexical-let ((output-buffer buffer)) - (lambda (process msg) - (let ((process-buffer (process-buffer process))) - (cond - ((string= "finished\n" msg) - (save-excursion - (set-buffer process-buffer) - (set-buffer-modified-p nil) - (beginning-of-buffer) - (if (string= (buffer-substring-no-properties (point-min) 25) "No definitions found for") - - ;; dict didn't find word in the given database - (let ((error-message (dict-get-error-message - (buffer-substring-no-properties (point-min) (- (search-forward "\n") 1))))) - (let ((similar-words (buffer-substring-no-properties (point) (- (point-max) 1)))) - (kill-buffer (current-buffer)) - (set-buffer output-buffer) - (set-buffer dict-similar-buffer) - (insert similar-words) - (message error-message))) - - ;; ok we've got an answer - (dict-add-result-to-buffer process-buffer output-buffer)))) - ((string-match "exited abnormally with code" msg) - (message msg))))))) - -(defsubst dict-default-dict-entry () - "Make a guess at a default dict entry. -This guess is based on the text surrounding the cursor." - (let (word) - (save-excursion - (setq word (current-word)) - (if (string-match "[._]+$" word) - (setq word (substring word 0 (match-beginning 0)))) - word))) - -;;;; -;;;; Lookup functions -;;;; - -(defun dict (word) - "Lookup a WORD in the dictionary." - (interactive (list (let* ((default-entry (dict-default-dict-entry)) - (input (read-string - (format "Dict entry%s: " - (if (string= default-entry "") - "" - (format " (default %s)" default-entry)))))) - (if (string= input "") - (if (string= default-entry "") - (error "No dict args given") default-entry) input)))) - (dict-get-answer word)) - -(defun dict-region (from to) - "Lookup a region (FROM, TO) in the dictionary." - (interactive (list (region-beginning) - (region-end))) - (dict (concat "\"" (buffer-substring-no-properties from to) "\""))) - -(defun dict-multiple (from to) - "Lookup every word from the region (FROM, TO) in the dictionary." - (interactive (list (region-beginning) - (region-end))) - (dict (buffer-substring-no-properties from to))) - -(defun dict-on-server (word server) - "Lookup a WORD in the dictionary on the given SERVER." - (interactive (list - (let* ((default-entry (dict-default-dict-entry)) - (input (read-string - (format "Dict entry%s: " - (if (string= default-entry "") - "" - (format " (default %s)" default-entry)))))) - (if (string= input "") - (if (string= default-entry "") - (error "No dict args given") default-entry) input)) - (read-string "DICT server: " nil))) - (if (not (string= server "")) - (let ((dict-servers `(,server))) - (dict word)) - (dict word))) - -(defun dict-show-similar () - "Show list of similar words." - (interactive) - (when (bufferp dict-similar-buffer) - (display-buffer dict-similar-buffer))) - -(defun dict-set-key-binding (key value) - "Set KEY binding customisation variable to VALUE." - (let ((result (set-default key value))) - (set-default 'dict-enable-key-bindings t) - (dict-update-key-bindings) - result)) - -(defun dict-set-enable-key-bindings (key value) - "Set KEY to VALUE and update dict key bindings." - (let ((result (set-default key value))) - (dict-update-key-bindings) - result)) - -(defun dict-process-key-binding (string) - "Process a STRING representing a key binding to allow easy key binding customisation." - (read (concat "\"" string "\""))) - -(defvar dict-mode-keymap (make-sparse-keymap)) - -(defun dict-mode-set-key-binding (key value) - "Set KEY binding customisation variable to VALUE (for DICT-mode)." - (let ((result (set-default key value))) - (dict-mode-update-key-bindings) - result)) - -(defun dict-mode () - (interactive) - (use-local-map dict-mode-keymap) - (setq mode-name "DICT") - (setq major-mode 'dict-mode)) - -(defun dict-update-key-bindings () - "Update dict key bindings." - (when dict-enable-key-bindings - ;; Setup global key binding `C-c d d' for running dict... - (global-set-key (dict-process-key-binding dict-key-binding) 'dict) - ;; ... `C-c d r' for running dict on the region... - (global-set-key (dict-process-key-binding dict-region-key-binding) 'dict-region) - ;; ... `C-c d m' for running dict on every word in the region... - (global-set-key (dict-process-key-binding dict-multiple-key-binding) 'dict-multiple) - ;; ... `C-c d s' for running dict to perform search on the given server. - (global-set-key (dict-process-key-binding dict-on-server-key-binding) 'dict-on-server) - ;; ... `S' to show similar words. - (global-set-key (dict-process-key-binding dict-similar-words-key-binding) 'dict-show-similar))) - - -(defun dict-mode-update-key-bindings () - "Update dict key bindings for DICT-mode." - ;; Setup DICT-mode key binding `d' for running dict... - (define-key dict-mode-keymap (dict-process-key-binding dict-mode-key-binding) 'dict) - ;; ... `r' for running dict on the region... - (define-key dict-mode-keymap (dict-process-key-binding dict-mode-region-key-binding) 'dict-region) - ;; ... `m' for running dict on every word in the region... - (define-key dict-mode-keymap (dict-process-key-binding dict-mode-multiple-key-binding) 'dict-multiple) - ;; ... `s' for running dict to perform search on the given server... - (define-key dict-mode-keymap (dict-process-key-binding dict-mode-on-server-key-binding) 'dict-on-server) - ;; ... `S' to show similar words. - (define-key dict-mode-keymap (dict-process-key-binding dict-mode-similar-words-key-binding) 'dict-show-similar)) - -;;;; -;;;; Informational functions -;;;; - -(defun dict-version () - "Display dict version information." - (interactive) - (shell-command "dict --version")) - -(defconst dict-version - "$Revision: 1.7 $" - "Version number for 'dict' package.") - -(defun dict-version-number () - "Return 'dict' version number." - (string-match "[0123456789.]+" dict-version) - (match-string 0 dict-version)) - -(defun dict-display-version () - "Display 'dict.el' version." - (interactive) - (message "dict.el version <%s>." (dict-version-number))) - -(dict-update-key-bindings) -(dict-mode-update-key-bindings) - -(provide 'dict) - -;;; dict.el ends here diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/emacs-goodies-custom.el emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/emacs-goodies-custom.el --- emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/emacs-goodies-custom.el 2011-11-07 21:43:14.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/emacs-goodies-custom.el 2016-11-22 04:44:45.000000000 +0000 @@ -104,16 +104,6 @@ ;;:require 'df :group 'emacs-goodies-el) -;; dict -(defgroup Dict nil - "Browse DICT dictionaries." - :prefix "dict-" - :group 'external - :link '(custom-manual "(emacs-goodies-el)dict") - :load 'dict -;;:require 'dict - :group 'emacs-goodies-el) - ;; diminish (defgroup diminish nil "Diminished modes are minor modes with no modeline display." @@ -310,15 +300,6 @@ :load 'matlab :group 'emacs-goodies-el) -;; markdown -(defgroup markdown nil - "Markdown mode." - :prefix "markdown-" - :group 'languages - :link '(custom-manual "(emacs-goodies-el)markdown-mode") - :load 'markdown-mode - :group 'emacs-goodies-el) - ;; minibuffer-complete-cycle (defgroup minibuffer-complete-cycle nil "Cycle through the *Completions* buffer." diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/emacs-goodies-el.el emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/emacs-goodies-el.el --- emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/emacs-goodies-el.el 2015-06-14 18:42:15.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/emacs-goodies-el.el 2016-11-22 04:44:45.000000000 +0000 @@ -58,18 +58,6 @@ (autoload 'csv-mode "csv-mode" "Major mode for editing comma-separated value files." t) -;; cyclebuffer.el -(autoload 'cyclebuffer-forward "cyclebuffer" - "Cycle buffer forward." - t) -(autoload 'cyclebuffer-backward "cyclebuffer" - "Cycle buffer backward." - t) - -;; dict.el -(autoload 'dict "dict" "Lookup a word in the dictionary" t) -(autoload 'dict-region "dict" "Lookup a region in the dictionary" t) - ;; ff-paths.el (defcustom ff-paths-install emacs-goodies-el-defaults "Whether to setup ff-paths for use. diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/emacs-goodies-el.texi emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/emacs-goodies-el.texi --- emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/emacs-goodies-el.texi 2011-11-07 21:43:14.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/emacs-goodies-el.texi 2016-11-22 04:44:45.000000000 +0000 @@ -1,7 +1,7 @@ @c -*- mode: texinfo -*- \input texinfo -@c $Id: emacs-goodies-el.texi,v 1.101 2011-08-16 16:15:05 psg Exp $ +@c $Id: emacs-goodies-el.texi,v 1.104 2016/11/06 20:08:20 psg Exp $ @c %**start of header @setfilename info/emacs-goodies-el @settitle Emacs-Goodies-el @@ -982,44 +982,7 @@ @node dict, diminish, df, Top @chapter dict - Emacs interface to dict client -This package is an Emacs wrapper around the shell @file{dict} command -and provides an easy and comfortable (from my point of view) access to -the dictd server from Emacs. - -The package provides several key bindings, which are customisation variables, -so you can change them easily: - -@itemize @bullet -@item -@key{C-c d d} for running dict with options defined by -customisation variables described below. - -@item -@key{C-c d r} for running dict on region as a single word. - -@item -@key{C-c d m} for running dict on every word in the region. - -@item -@key{C-c d s} for running dict to perform search on the given server. - -@item -@key{C-c d w} for running wordinspect GUI dict client. -@end itemize - -The Debian emacs-goodies-el package doesn't setup these keys by -default. The first time you use @code{dict} in a session you must do -so manually with @code{M-x dict}. Thereafter the keybindings will -work. If someone requests it, a customization variable could be added -to enable them automatically. - -Descriptions of all customisation variables are given below in their -definitions, and of cause you can find them in the customization of -the grou @code{Dict}. - -The author hopes you find the program useful and would like to know -your opinion about the program, improvement suggestions and of course -bug reports. Mail them to max-appolo@@mail.ru +Removed in emacs-goodies-el V36.0; Use dictionary-el instead. @node diminish, dir-locals, dict, Top @chapter diminish - Diminish minor-mode's display @@ -2867,25 +2830,8 @@ @node markdown-mode, marker-visit, map-lines, Top @chapter markdown-mode - Major mode for editing Markdown files -@noindent Author: Jason Blevins - -This major mode provides syntax highlighting and basic element insertion -commands for Markdown files. - -No extension gets associated with this mode by default since there is no -official extension: .mdml, .text, .md, .mdt, etc. - -To use this mode, either invoke it each time with: - -@example - M-X markdown-mode -@end example - -or insert the following snippet of code in your @file{.emacs} file. - -@example - (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode)) -@end example +This was removed from emacs-goodies-el V36.0 because it is packaged +separately as elpa-markdown-mode. @node marker-visit, matlab, markdown-mode, Top @chapter marker-visit - navigate through a buffer's marks in order diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/maplev.el emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/maplev.el --- emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/maplev.el 2015-06-14 19:01:22.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/maplev.el 2016-11-22 04:44:45.000000000 +0000 @@ -1,31 +1,27 @@ ;;; maplev.el --- Maple mode for GNU Emacs ;; ;; -;; Copyright (C) 2001,2003 Joseph S. Riel +;; Copyright (C) 2001,2003,2008,2009 Joseph S. Riel -;; Authors: Joseph S. Riel +;; Authors: Joseph S. Riel ;; and Roland Winkler -;; Time-stamp: "2003-10-09 22:49:16 joe" ;; Created: June 1999 -;; Version: 2.155 +;; Version: 2.27 ;; Keywords: Maple, languages -;; X-URL: http://www.k-online.com/~joer/maplev/maplev.html -;; X-RCS: $Id: maplev.el,v 1.3 2009/11/12 21:33:35 psg Exp $ ;;{{{ License ;; This program 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 of the -;; License, or (at your option) any later version. -;; This program 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 this program; if not, write to the Free Software -;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -;; 02111-1307, USA. +;; License, or (at your option) any later version. This program 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 this program; if not, write +;; to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;}}} ;;{{{ Introduction @@ -109,12 +105,10 @@ ;;{{{ Information -(defconst maplev-version - "2.155" - "Version of MapleV mode.") +(defconst maplev-version "2.27" "Version of MapleV mode.") (defconst maplev-developer - "Joseph S. Riel and Roland Winkler " + "Joseph S. Riel " "Developers/maintainers of maplev-mode.") (defun maplev-about () @@ -128,7 +122,7 @@ (require 'font-lock) (require 'comint) (require 'info) -(require 'cl) +(require 'button-lock) (eval-and-compile (condition-case nil (require 'imenu) (error nil)) @@ -215,6 +209,10 @@ "STUFF THAT MUST BE CONFIGURED." :group 'maplev) +(defgroup maplev-declarations nil + "Customizations for declaring variables." + :group 'maplev) + (defgroup maplev-faces nil "Faces for highlighting text in MapleV mode." :group 'maplev) @@ -240,37 +238,36 @@ ;;{{{ executables +(defun maplev-windows-executables (major-release &optional num-exe ini-file) + (let ((num (if num-exe major-release ""))) + (list (format "c:/Program Files/Maple Release %s/bin.wnt/cmaple%s.exe" major-release num) + ini-file + (format "c:/Program Files/Maple Release %s/bin.wnt/mint%s.exe" major-release num) + ))) + (defcustom maplev-executable-alist (if (string-match "windows-nt\\|ms-dos" (symbol-name system-type)) - '( - ("11" . ("c:/Program Files/Maple Release 11/bin.wnt/cmaple11.exe" - nil - "c:/Program Files/Maple Release 10/bin.wnt/mint10.exe")) - ("10" . ("c:/Program Files/Maple Release 10/bin.wnt/cmaple10.exe" - nil - "c:/Program Files/Maple Release 10/bin.wnt/mint10.exe")) - ("9" . ("c:/Program Files/Maple Release 9/bin.wnt/cmaple9.exe" - nil - "c:/Program Files/Maple Release 9/bin.wnt/mint9.exe")) - ("8" . ("c:/Program Files/Maple Release 8/bin.wnt/cmaple.exe" - nil - "c:/Program Files/Maple Release 8/bin.wnt/mint.exe")) - ("7" . ("c:/Program Files/Maple Release 7/bin.wnt/cmaple.exe" - nil - "c:/Program Files/Maple Release 7/bin.wnt/mint.exe")) - ("6" . ("c:/Program Files/Maple Release 6/bin.wnt/cmaple.exe" - nil - "c:/Program Files/Maple Release 6/bin.wnt/mint.exe")) - ("5.1" . ("c:/Program Files/MapleV Release 5.1/bin.wnt/cmaple.exe" - nil - "c:/Program Files/MapleV Release 5.1/bin.wnt/mint.exe")) - ("5" . ("c:/Program Files/MapleV Release 5/bin.wnt/cmaple.exe" - nil - "c:/Program Files/MapleV Release 5/bin.wnt/mint.exe")) - ("4" . ("c:/maplev4/bin.win/cmaple.exe" - nil - "c:/maplev4/bin.win/mint.exe"))) + `(("16" . ,(maplev-windows-executables "16" t)) + ("15" . ,(maplev-windows-executables "15" t)) + ("14" . ,(maplev-windows-executables "14" t)) + ("13" . ,(maplev-windows-executables "13" t)) + ("12" . ,(maplev-windows-executables "12" t)) + ("11" . ,(maplev-windows-executables "11" t)) + ("10" . ,(maplev-windows-executables "10" t)) + ("9" . ,(maplev-windows-executables "9" t)) + ("8" . ,(maplev-windows-executables "8" t)) + ("7" . ,(maplev-windows-executables "7" t)) + ("6" . ,(maplev-windows-executables "6" t)) + ("5" . ,(maplev-windows-executables "5" t)) + ("4" . ,(maplev-windows-executables "4" t)) + ("3" . ,(maplev-windows-executables "3" t))) + '( + ("16" . ("maple" nil "mint")) + ("15" . ("maple" nil "mint")) + ("14" . ("maple" nil "mint")) + ("13" . ("maple" nil "mint")) + ("12" . ("maple" nil "mint")) ("11" . ("maple" nil "mint")) ("10" . ("maple" nil "mint")) ("9" . ("maple" nil "mint")) @@ -280,7 +277,7 @@ ("5.1" . ("maple" nil "mint")) ("5" . ("maple" nil "mint")) ("4" . ("maple" nil "mint")))) - "*Assoc list specifying the available executables. + "Assoc list specifying the available executables. Each item has the form \(RELEASE MAPLE MAPLE-INIFILE MINT\) where RELEASE is the Maple release corresponding to the executables MAPLE and MINT. MAPLE must be the command line @@ -298,8 +295,8 @@ ;; this isn't quite right, it doesn't permit assigning ;; a new release. -(defcustom maplev-default-release "11" - "*Release of Maple used as the default executable. +(defcustom maplev-default-release "15" + "Release of Maple used as the default executable. It must be a key in `maplev-executable-alist'." :type `(choice ,@(mapcar (lambda (item) (list 'const (car item))) @@ -312,78 +309,37 @@ Used to index `maplev-executable-alist'.") (make-variable-buffer-local 'maplev-release) +(defconst maplev-interface-kernelopts-settings + (concat "interface('prettyprint=1,verboseproc=2,errorbreak=0,warnlevel=2,errorcursor=false,screenheight=infinity'):\n" + "kernelopts('printbytes=false'):\n" ) + "Maple commands that assign the default interface and kernelopts settings." ) + +(defcustom maplev-default-init-string + (concat + "maplev_print := `if`(assigned(maplev['PrintProc']),maplev:-PrintProc,print):\n" + maplev-interface-kernelopts-settings) + "Default Maple commands used to initialize a Maple process. +Use `maplev-init-string-alist' to customize initialization commands +for particular releases.") + (defcustom maplev-init-string-alist - (let ((maplev-print-R5- - (concat - "if not assigned(maplev_print) then\n" - " maplev_print := proc(n)\n" - " print(`if`(type(evaln(n),'procedure'),eval,readlib)(n))\n" - " end;\n" - "fi:\n")) - (maplev-print-R6+ + (let ((init (concat - "if not assigned(maplev_print) then" - " maplev_print := print " - "fi:\n")) - (maplev-interface-string - (concat - "prettyprint=1," - "verboseproc=2," - "errorbreak=0,\n" - "screenheight=infinity," - "warnlevel=2")) - (maplev-kernelopts "kernelopts(printbytes=false):\n")) - `( - ("11" . ,(concat maplev-print-R6+ - "interface(" maplev-interface-string - ",errorcursor=false):\n" - maplev-kernelopts)) - ("10" . ,(concat maplev-print-R6+ - "interface(" maplev-interface-string - ",errorcursor=false):\n" - maplev-kernelopts)) - ("9.5" . ,(concat maplev-print-R6+ - "interface(" maplev-interface-string - ",errorcursor=false):\n" - maplev-kernelopts)) - ("9" . ,(concat maplev-print-R6+ - "interface(" maplev-interface-string - ",errorcursor=false):\n" - maplev-kernelopts)) - ("8" . ,(concat maplev-print-R6+ - "interface(" maplev-interface-string - ",errorcursor=false):\n" - maplev-kernelopts)) - ("7" . ,(concat maplev-print-R6+ - "interface(" maplev-interface-string - ",errorcursor=false):\n" - maplev-kernelopts)) - ("6" . ,(concat maplev-print-R6+ - "interface(" maplev-interface-string - ",errorcursor=false):\n" - maplev-kernelopts)) - ("5.1" . ,(concat maplev-print-R5- - "interface(" maplev-interface-string - ",errorcursor=false):\n" - maplev-kernelopts)) - ("5" . ,(concat maplev-print-R5- - "interface(" maplev-interface-string - ",errorcursor=false):\n" - maplev-kernelopts)) - ("4" . ,(concat maplev-print-R5- - "interface(" maplev-interface-string "):\n" - maplev-kernelopts)) - )) - "*Assoc list of Maple commands initializing a maple session. + "if not assigned(maplev_print) then maplev_print := proc(n)print(`if`(type(evaln(n),'procedure'),eval,readlib)(n))end:fi:\n" + maplev-interface-kernelopts-settings))) + `(("5.1" . ,init) + ("5" . ,init))) + "Assoc list of Maple commands initializing a maple session. Each item has the form \(RELEASE COMMANDS\) where RELEASE is the -Maple release. COMMANDS must be a string of Maple commands." +Maple release. COMMANDS must be a string of Maple commands. +Overrides `maplev-default-init-string'." :type '(repeat (cons (string :tag "Maple Release") (string :tag "Maple Commands"))) :group 'maplev-executables :group 'maplev-important) (defcustom maplev-mint-info-level 3 - "*Integer controlling amount of information that Mint outputs." + "Integer controlling amount of information that Mint outputs." :type '(choice (const :tag "no info" 0) (const :tag "severe errors" 1) (const :tag "+ serious errors" 2) @@ -392,7 +348,7 @@ :group 'maplev-mint) (defcustom maplev-mint-error-level 1 - "*Integer controlling Mint error checking in Maple input." + "Integer controlling Mint error checking in Maple input." :type '(choice (const :tag "no info" 0) (const :tag "severe errors" 1) (const :tag "+ serious errors" 2) @@ -401,7 +357,7 @@ :group 'maplev-mint) (defcustom maplev-mint-start-options (list "-q") - "*List of mint command line options. + "List of mint command line options. Do not include the info level or the include path, they are handled by `maplev-mint-info-level' and `maplev-include-path'." :type 'list @@ -417,7 +373,7 @@ :group 'maplev-mint) (defcustom maplev-include-path nil - "*List of directories to search for files to include. + "List of directories to search for files to include. Each element is a string (directory name) or nil. The directories are passed to maple and to mint via the \"-I\" option; they are searched for files @@ -426,60 +382,94 @@ :group 'maplev-executables :group 'maplev-mint) +(make-variable-buffer-local 'maplev-include-path) + ;;}}} ;;{{{ comments (defcustom maplev-comment-column 40 - "*Column for inline comments. + "Column for inline comments. Use \\[indent-for-comment] to insert or align an inline comment." :type 'integer :group 'maplev-comments) (defcustom maplev-comment-start "#" - "*String to insert to start a Maple inline comment." + "String to insert to start a Maple inline comment." :type 'string :group 'maplev-comments) ;; not used by GNU emacs 21 (defcustom maplev-block-comment-start "# " - "*String to insert to start a Maple standalone comment." + "String to insert to start a Maple standalone comment." :type 'string :group 'maplev-comments) (defcustom maplev-auto-fill-comment-flag t - "*Non-nil means initially enable `auto-fill-mode' in a Maple buffer." + "Non-nil means initially enable `auto-fill-mode' in a Maple buffer." :type 'boolean :group 'maplev-comments) ;;}}} +;;{{{ declarations + +(defcustom maplev-var-declaration-symbol " :: " + "Separator inserted between declared variable and type." + :type 'string + :group 'maplev-declarations) + +(defcustom maplev-alphabetize-declarations-p nil + "If non-nil, variable declarations are alphabetized. +Only works if `maplev-add-declaration-function' is assigned +either `maplev-add-declaration-leading-comma' or +`maplev-add-declaration-trailing-comma'." + :type 'boolean + :group 'maplev-declarations) + +(defcustom maplev-add-declaration-function 'maplev-add-declaration-trailing-comma + "Selects the function that adds variables to a declaration." + :type '(radio + (function-item :doc "declarations on one line" maplev-add-declaration-one-line) + (function-item :doc "declarations on separate lines, with leading comma" maplev-add-declaration-leading-comma) + (function-item :doc "declarations on separate lines, with trailing comma" maplev-add-declaration-trailing-comma)) + :group 'maplev-declarations) + + + + +;;}}} ;;{{{ indentation (defcustom maplev-indent-level 4 - "*Indentation of Maple statements with respect to containing block." + "Indentation of Maple statements with respect to containing block." :type 'integer :group 'maplev-indentation) (defcustom maplev-indent-declaration 0 - "*Indentation of Maple declarations \(local, global, option, description\)." + "Indentation of Maple declarations \(local, global, option, description\)." :type 'integer :group 'maplev-indentation) (defcustom maplev-dont-indent-re "[#$]" - "*Lines starting with this regular expression will not be auto-indented." + "Lines starting with this regular expression will not be auto-indented." :type '(choice string (const :tag "default" nil)) :group 'maplev-indentation) - + +(defcustom maplev-auto-break-strings-flag t + "Strings in code will be automatically broken when they pass the `current-fill-column'." + :type 'boolean + :group 'maplev-indentation) + ;;}}} ;;{{{ templates (defcustom maplev-copyright-owner "John Q. Public" - "*Copyright owner inserted in the copyright string by `maplev--template-proc-module'." + "Copyright owner inserted in the copyright string by `maplev--template-proc-module'." :type 'string :group 'maplev-templates :group 'maplev-important) (defcustom maplev-comment-end-flag t - "*Non-nil means add a template's name as a comment following the end. + "Non-nil means add a template's name as a comment following the end. See `maplev--template-proc-module'." :type 'boolean :group 'maplev-templates) @@ -490,31 +480,31 @@ ;;; display it I might use " #\# ", which also prints the hash. (defcustom maplev-template-end-comment " # " - "*String prepended to the name of a template at the end, + "String prepended to the name of a template at the end, following the \"end\". See `maplev-comment-end-flag'." :type 'string :group 'maplev-templates) (defcustom maplev-insert-copyright-flag t - "*Non-nil means insert `maplev-copyright-owner' in a template. + "Non-nil means insert `maplev-copyright-owner' in a template. See `maplev-template'." :type 'boolean :group 'maplev-templates) (defcustom maplev-description-quote-char ?\` - "*Quote character for the description statement. + "Quote character for the description statement. Maple uses a backquote; however, in R5 it makes more sense to use a double quote. Procbody, alas, does not handle a double quote." :type 'character :group 'maplev-templates) (defcustom maplev-variable-spacing 0 - "*Spaces to insert after a comma in declarations and argument lists." + "Spaces to insert after a comma in declarations and argument lists." :type 'integer :group 'maplev-templates) (defcustom maplev-assignment-operator " := " - "*Maple assignment operator. Used by `maplev-insert-assignment-operator'." + "Maple assignment operator. Used by `maplev-insert-assignment-operator'." :type 'string :group 'maplev-templates) @@ -522,7 +512,7 @@ ;;{{{ completion (defcustom maplev-completion-longdelim-p nil - "*If non-nil use the long delimiter when completing a Maple control structure. + "If non-nil use the long delimiter when completing a Maple control structure. For example, if non-nil, a `do' loop is completed with `end do', otherwise it is completed with `od'. If the maple release is less than 6 than the long delimiter is never used." @@ -532,24 +522,54 @@ ;;}}} ;;{{{ miscellaneous +;; Leading commas + +(defcustom maplev-leading-comma-flag t + "Non-nil means the user prefers leading commas when continuing lines. +Currently this only determines whether advice for `fixup-whitespace' +is activated when maplev-mode is executed." + :type 'boolean + :group 'maplev-misc) + ;; Abbrev mode (defcustom maplev-initial-abbrev-mode-flag nil - "*Non-nil means initially enable function `abbrev-mode' in a Maple buffer." + "Non-nil means initially enable function `abbrev-mode' in a Maple buffer." :type 'boolean :group 'maplev-misc) (defcustom maplev-expand-abbrevs-in-comments-and-strings-flag nil - "*Non-nil means expand Maple abbreviations in comments and strings. + "Non-nil means expand Maple abbreviations in comments and strings. Nil means do not expand in either." :type 'boolean :group 'maplev-misc :group 'maplev-comments) +(defcustom maplev-include-file-other-window-flag t + "Non-nil means the default action is to open an include file +in the other window. See `maplev-find-include-file'." + :type 'boolean + :group 'maplev-misc) + +;; Configuration + +(defcustom maplev-buttonize-includes-flag t + "Non-nil means use `button-lock-mode' to hyperlink include statements." + :type 'boolean + :group 'maplev-misc) + +(defcustom maplev-load-config-file-flag t + "Non-nil means load a configuration file when starting maplev-mode. +The configuration file is named .maplev and is searched for in the current directory +and its ancestors. The file is loaded as an elisp file. No error occurs if +the file does not exist." + :type 'boolean + :group 'maplev-misc) + ;; Saving (defcustom maplev-clean-buffer-before-saving-flag t - "*Non-nil means run `maplev-remove-trailing-spaces' before saving." + "Non-nil means run `maplev-remove-trailing-spaces' before saving." :type 'boolean :group 'maplev-misc) @@ -593,7 +613,7 @@ (maple-comment (regexp . "\\(\\s-+\\)\\s<") (column . comment-column))) - "*A list describing the maplev alignment rules. + "A list describing the maplev alignment rules. See the documentation for `align-rules-list' for more info on the format." :type align-rules-list-type :group 'maplev-align) @@ -619,7 +639,7 @@ (concat "[^ \t\n\\\\]" (regexp-quote comment-start) "\\(.+\\)$") end t)))))) - "*A list describing text that should be excluded from alignment. + "A list describing text that should be excluded from alignment. See the documentation for `align-exclude-rules-list' for more info." :type align-rules-list-type :group 'maplev-align))) @@ -648,6 +668,14 @@ (defvar maplev-history-list nil "History list used by maplev.") +(defvar maplev-use-indent-info t + "Buffer local variable that speeds up indentation when non nil. +May interfere with some modes (e.g. noweb).") +(make-variable-buffer-local 'maplev-use-indent-info) + +(defvar maplev--declaration-history nil + "History list used for type declarations.") + ;;}}} ;;{{{ Regular expressions @@ -656,7 +684,7 @@ "\\<\\(?:local\\|options?\\|global\\|description\\|export\\|uses\\)\\>" "Regular expression for a Maple procedure declaration statement.") -(defconst maplev--simple-name-re "\\<[a-zA-Z_][a-zA-Z0-9_]*\\>" +(defconst maplev--simple-name-re "\\_<[a-zA-Z_%][a-zA-Z0-9_?]*~?\\_>" "Regular expression for a simple name.") (defconst maplev--quoted-name-re "`[^`\n\\\\]*\\(?:\\\\.[^`\n\\\\]*\\)*`" @@ -679,6 +707,16 @@ "\\(?:[ \t\n\f]*([^)(]*)\\)*") ; optional arguments "Regular expression for Maple names.") +;; (defconst maplev--var-with-optional-type (concat +;; "\\(" maplev--simple-name-re "\\)" +;; "\\(?:\\s-*::\\s-*" +;; "\\(" +;; maplev--type-re +;; "\\)\\)?") +;; "Regular expression for a variable with optional type declaration. +;; The variable matches group one, the type matches group 2.") + + (defconst maplev--comment-re "#.*$" "Regular expression for Maple comments. A backslash at the end of the line does not continue the comment.") @@ -697,16 +735,26 @@ "\\('?" maplev--name-re "'?\\)[ \t\n]*:?=[ \t\n]*") "Regular expression that matches a Maple assignment.") +(defconst maplev--possibly-typed-assignment-re + (concat "^\\s-*\\(local\\|global\\|export\\)?\\s-*" + "\\('?" maplev--name-re "'?\\)" + "\\(?:[ \t\n]*::[ \t\n]*\\(" maplev--name-re "\\)\\)?" + "[ \t\n]*:?=[ \t\n]*") + "Regular expression that matches a Maple assignment that may +include a type declaration. The second group correponds to the +assignee, the second group to the type. This only works with +an assignment to a name, it does not match an assignment to +a sequence.") (defconst maplev--defun-begin-re ;; This regular expression does not match a named module, ;; nor does it match a procedure/module that is not an ;; assignment statement. - (concat maplev--assignment-re + (concat maplev--possibly-typed-assignment-re ;; assignment-re "\\(?:" maplev--comment-re "\\)?" "[ \t\f\n]*" maplev--defun-re) "Regular expression for Maple defun assignments. -The first group corresponds to the name of the defun.") +The second group corresponds to the name of the defun.") (defconst maplev--top-defun-begin-re (concat "^\\(" maplev--name-re "\\)[ \t\n]*:=[ \t\n]*" @@ -767,6 +815,8 @@ (unless maplev-mode-syntax-table (let ((table (make-syntax-table))) (modify-syntax-entry ?_ "_" table) ; symbol constituent + (modify-syntax-entry ?~ "_" table) ; symbol constituent + (modify-syntax-entry ?? "_" table) ; symbol constituent (modify-syntax-entry ?& "w" table) ; word constituent (modify-syntax-entry ?\\ "\\" table) ; escape (modify-syntax-entry ?# "<" table) ; comment starter @@ -775,28 +825,32 @@ (modify-syntax-entry ?\r " " table) ; return = whitespace (modify-syntax-entry ?\t " " table) ; tab = whitespace - (modify-syntax-entry ?* "." table) ; punctuation + (modify-syntax-entry ?* ". 23b" table) ; punctuation and used in multiline comments (* ... *) (modify-syntax-entry ?/ "." table) (modify-syntax-entry ?+ "." table) (modify-syntax-entry ?- "." table) (modify-syntax-entry ?= "." table) - (modify-syntax-entry ?< "." table) - (modify-syntax-entry ?> "." table) - (modify-syntax-entry ?. "." table) + ;; this is for noweb-mode +;; (modify-syntax-entry ?< ". 12" table) +;; (modify-syntax-entry ?> ". 34" table) + (modify-syntax-entry ?. "." table) (modify-syntax-entry ?\' "\"" table) ; string quotes (modify-syntax-entry ?\` "\"" table) ; string quotes (modify-syntax-entry ?\{ "(}" table) ; balanced brackets (modify-syntax-entry ?\[ "(]" table) - (modify-syntax-entry ?\( "()" table) + (modify-syntax-entry ?\( "()1n" table) (modify-syntax-entry ?\} "){" table) (modify-syntax-entry ?\] ")[" table) - (modify-syntax-entry ?\) ")(" table) + (modify-syntax-entry ?\) ")(4n" table) ;; Entries for R5 and later (modify-syntax-entry ?% "." table) (modify-syntax-entry ?\" "\"" table) + ;; Entries for R12 and later. + ;; Define the multiline comment delimiters `(*' and `*)'. + (setq maplev-mode-syntax-table table))) (defvar maplev-mode-4-syntax-table nil @@ -810,7 +864,7 @@ (modify-syntax-entry ?\" "." maplev-mode-4-syntax-table)) (defvar maplev--symbol-syntax-table nil - "Syntax table for Maple, where `_' is a word consituent.") + "Syntax table for Maple, where `_' is a word constituent.") (unless maplev--symbol-syntax-table (setq maplev--symbol-syntax-table (copy-syntax-table maplev-mode-syntax-table)) @@ -856,14 +910,16 @@ "Buffer local variable storing previous indent information. Nil when there is no previous, or valid, indent information. -Otherwise it's a list: \(POINT STATE STACK\). POINT is the character -position at which the information applies. STATE is the output of -`parse-partial-sexp' \(valid from the start of the buffer to POINT\). -STACK is a list of lists, each list having the form \(KEYWORD -INDENT-CLOSE INDENT-FOLLOW\). KEYWORD is a keyword or parenthesis in -the source. INDENT-CLOSE is the indentation amount for the closing -keyword associated with KEYWORD. INDENT-FOLLOW is the indentation -amount for source between KEYWORD and its closing keyword.") +Otherwise it's a list: \(POINT STATE STACK\). POINT is the +buffer character position at which the information applies. +STATE is the output of `parse-partial-sexp' \(valid from the +start of the buffer to POINT\). STACK is a list of lists, each +list having the form \(KEYWORD INDENT-CLOSE INDENT-FOLLOW\). +KEYWORD is a keyword or parenthesis in the source. INDENT-CLOSE +is the indentation for the closing keyword associated with +KEYWORD. INDENT-FOLLOW is the indentation for source between +KEYWORD and its closing keyword. Indentation is measured in +characters, with 0 being the left margin.") ;; Procedures for accessing the contents of `maplev--indent-info'. @@ -893,8 +949,10 @@ "Update the variable `maplev--indent-info' if nil. Set POINT in variable to closest valid starting point. Set STATE and STACK in variable to nil." - (unless (and maplev--indent-info - (>= (point) (maplev--indent-info-point))) + (unless (and + maplev-use-indent-info + maplev--indent-info + (>= (point) (maplev--indent-info-point))) ;; Set POINT to (point) if we're at the beginning of a top level ;; procedure assignment, otherwise search backwards for the ;; beginning or end of a top level procedure assignment and put @@ -905,10 +963,12 @@ ;; Handle noweb mode. ;; If noweb is active in the buffer, then search for ;; the chunk starter. - (and (boundp 'noweb-minor-mode) noweb-minor-mode - (save-excursion - (when (re-search-backward "^<<\\(.*\\)>>=$" nil t) - (1+ (match-end 0))))) + ;;(and + ;;(boundp 'noweb-minor-mode) noweb-minor-mode + ;;(eq mmm-classes 'noweb) + (save-excursion + (when (re-search-backward "^<<\\(.*\\)>>=$" nil t) + (1+ (match-end 0)))) (save-excursion (when (re-search-backward (concat "\\(" maplev--top-defun-begin-re "\\)\\|" @@ -930,7 +990,45 @@ ;;}}} ;;{{{ grammar -(defconst maplev--grammar-alist nil +(defconst maplev--grammar-alist + +;; Removed "in" from grammar to allow its use as a binary operator in Maple R8. +;; The change in the indentation is minor; rarely is there a line break between +;; an "in" and the "do" in a loop. + + (list + (list "proc" . ("\\" t maplev-indent-level 'maplev--indent-point-of-proc)) + (list "module" . ("\\" t maplev-indent-level 'maplev--indent-point-of-proc)) + (list "end" . (nil nil 0 nil 'maplev--skip-optional-end-keyword)) +;;; (list "for" . ((maplev--list-to-word-re '("from" "to" "by" "while" "in" "do")) t 0)) + (list "for" . ((maplev--list-to-word-re '("from" "to" "by" "while" "do")) t 0)) + (list "from" . ((maplev--list-to-word-re '("to" "by" "while" "do")) t 0)) + (list "to" . ((maplev--list-to-word-re '("by" "while" "do")) t 0)) + (list "by" . ((maplev--list-to-word-re '("from" "to" "while" "do")) t 0)) + (list "while" . ((maplev--list-to-word-re '("from" "to" "by" "do")) t 0)) +;;; (list "in" . ((maplev--list-to-word-re '("while" "do" "end")) t maplev-indent-level)) + (list "do" . ((maplev--list-to-word-re '("od" "end")) t maplev-indent-level)) + (list "od" . (nil nil 0)) + + (list "if" . ("\\" t 0)) + (list "elif" . ("\\" nil 0)) + (list "else" . ((maplev--list-to-word-re '("fi" "end")) nil maplev-indent-level)) + (list "then" . ((maplev--list-to-word-re '("elif" "else" "fi" "end")) nil maplev-indent-level)) + (list "fi" . (nil nil 0)) + +;;; (list "use" . ("\\" t maplev-indent-level)) + (list "use" . ("\\" t maplev-indent-level)) + (list "try" . ((maplev--list-to-word-re '("catch" "finally" "end")) t maplev-indent-level)) + (list "catch". ((maplev--list-to-word-re '("catch" "finally" "end")) t maplev-indent-level)) + (list "finally". ((maplev--list-to-word-re '("end")) t maplev-indent-level)) + + (list "{" . ("}" t nil)) + (list "[" . ("]" t nil)) + (list "(" . (")" t nil)) + (list "}" . (nil nil 0)) + (list "]" . (nil nil 0)) + (list ")" . (nil nil 0))) + "Assoc list defining the grammar for Maple indentation. Each entry has the form \(KEY . \(MATCH-RE OPEN-P INDENT ADJUST-FUNC POST-FUNC\)\). KEY is a Maple keyword or parenthesis. MATCH-RE is a @@ -944,46 +1042,7 @@ optional, if non-nil it is a function that is called after the keyword is handled. Currently it is only used by the keyword `end'.") -;; Removed "in" from grammar to allow its use as a binary operator in Maple R8. -;; The change in the indentation is minor; rarely is there a line break between -;; an "in" and the "do" in a loop. - -(unless maplev--grammar-alist - (let ((alist - (list - (list "proc" . ("\\" t maplev-indent-level 'maplev--indent-point-of-proc)) - (list "module" . ("\\" t maplev-indent-level 'maplev--indent-point-of-proc)) - (list "end" . (nil nil 0 nil 'maplev--skip-optional-end-keyword)) -;;; (list "for" . ((maplev--list-to-word-re '("from" "to" "by" "while" "in" "do")) t 0)) - (list "for" . ((maplev--list-to-word-re '("from" "to" "by" "while" "do")) t 0)) - (list "for" . ((maplev--list-to-word-re '("from" "to" "by" "while""do")) t 0)) - (list "from" . ((maplev--list-to-word-re '("to" "by" "while" "do")) t 0)) - (list "to" . ((maplev--list-to-word-re '("by" "while" "do")) t 0)) - (list "by" . ((maplev--list-to-word-re '("from" "to" "while" "do")) t 0)) - (list "while" . ((maplev--list-to-word-re '("from" "to" "by" "do")) t 0)) -;;; (list "in" . ((maplev--list-to-word-re '("while" "do" "end")) t maplev-indent-level)) - (list "do" . ((maplev--list-to-word-re '("od" "end")) t maplev-indent-level)) - (list "od" . (nil nil 0)) - - (list "if" . ("\\" t 0)) - (list "elif" . ("\\" nil 0)) - (list "else" . ((maplev--list-to-word-re '("fi" "end")) nil maplev-indent-level)) - (list "then" . ((maplev--list-to-word-re '("elif" "else" "fi" "end")) nil maplev-indent-level)) - (list "fi" . (nil nil 0)) -;;; (list "use" . ("\\" t maplev-indent-level)) - (list "use" . ("\\" t maplev-indent-level)) - (list "try" . ((maplev--list-to-word-re '("catch" "finally" "end")) t maplev-indent-level)) - (list "catch". ((maplev--list-to-word-re '("catch" "finally" "end")) t maplev-indent-level)) - (list "finally". ((maplev--list-to-word-re '("end")) t maplev-indent-level)) - - (list "{" . ("}" t nil)) - (list "[" . ("]" t nil)) - (list "(" . (")" t nil)) - (list "}" . (nil nil 0)) - (list "]" . (nil nil 0)) - (list ")" . (nil nil 0))))) - (setq maplev--grammar-alist alist))) (defconst maplev--grammar-keyword-re @@ -997,7 +1056,7 @@ "if" "elif" "else" "then" "fi" "use" "try" "catch" "finally")) "\\|\\(" - (regexp-opt '("{" "}" "[" "]" "(" ")" )) + (regexp-opt '("{" "}" "[" "]" "(" ")" "(*" "*)" )) "\\)")) "Regular expression of keywords used in Maple grammar for indentation.") @@ -1048,8 +1107,8 @@ If procedure is anonymous, point is not moved and nil is returned. Otherwise point is moved to left of assignee and point is returned." ;; Regexp does not include possible comments. - (and (re-search-backward (concat maplev--assignment-re "\\=") nil t) - (goto-char (match-beginning 1)))) + (and (re-search-backward (concat maplev--possibly-typed-assignment-re "\\=") nil t) + (goto-char (match-beginning 2)))) (defun maplev--indent-line-with-info () "Indent the current line as Maple code. Point must be at the left margin." @@ -1133,7 +1192,7 @@ (cond ;; If KEYWORD is in a comment or a quote, do nothing. - ((or (nth 4 state) (nth 3 state))) ; comments are more frequent, so check first + ((or (nth 4 state) (nth 3 state) (string= keyword "*)"))) ; comments are more frequent, so check first ;; Does KEYWORD pair with the top one on STACK? ((and match-re (string-match match-re keyword)) @@ -1204,7 +1263,7 @@ (defun maplev--compute-indent (indent-info) "Return the indentation required for a Maple code line. INDENT-INFO is the indentation information applicable to this line; -it it is a list of three items: \(KEYWORD INDENT-CLOSE INDENT-FOLLOW\). +it is a list of three items: \(KEYWORD INDENT-CLOSE INDENT-FOLLOW\). See `maplev--indent-info' for details. If INDENT-INFO is nil then 0 is returned. Point must be at current indentation." (if (not indent-info) @@ -1215,7 +1274,8 @@ (cond ;; Handle declarations in procedures (and modules) ((and (string-match maplev--defun-re (car indent-info)) - (looking-at maplev--declaration-re)) + (with-syntax-table maplev--symbol-syntax-table + (looking-at maplev--declaration-re))) (+ maplev-indent-declaration (nth 1 indent-info))) ;; Continued dotted quotes, e.g. ``."a string".'' @@ -1375,6 +1435,7 @@ ;; (define-key map [(meta control e)] 'maplev-end-of-proc) (define-key map [(control x) ?n ?d] 'maplev-narrow-to-defun) + ;; These two bindings are needed only under linux / unix (define-key map [(meta control y)] 'maplev-insert-cut-buffer) (define-key map (maplev--mouse-keymap '(control meta 2)) 'maplev-mouse-yank-cut-buffer) @@ -1395,6 +1456,7 @@ (define-key map [(control c) (control c) ?b] 'maplev-cmaple-send-buffer) (define-key map [(control c) (control c) ?p] 'maplev-cmaple-send-procedure) (define-key map [(control c) (control c) ?r] 'maplev-cmaple-send-region) + (define-key map [(control c) (control c) ?l] 'maplev-cmaple-send-line) (define-key map [(control c) (control c) return] 'maplev-cmaple-send-line) (define-key map [(control c) (control c) ?g] 'maplev-cmaple-pop-to-buffer) (define-key map [(control c) (control c) ?i] 'maplev-cmaple-interrupt) @@ -1403,15 +1465,16 @@ ;; Mint commands - (define-key map [(control c) (return) ?b] 'maplev-mint-buffer) - (define-key map [(control c) (return) ?p] 'maplev-mint-procedure) - (define-key map [(control c) (return) ?r] 'maplev-mint-region) - (define-key map [(control c) (return) return] 'maplev-mint-rerun) + (define-key map [(control c) return ?b] 'maplev-mint-buffer) + (define-key map [(control c) return ?p] 'maplev-mint-procedure) + (define-key map [(control c) return ?r] 'maplev-mint-region) + (define-key map [(control c) return return] 'maplev-mint-rerun) ;; Help and proc comma (define-key map [(control ?\?)] 'maplev-help-at-point) (define-key map [(meta ?\?)] 'maplev-proc-at-point) + (define-key map [(control h) (meta d)] 'maplev-what-proc) ;; Xemacs and FSF Emacs use different terms for mouse buttons @@ -1454,10 +1517,10 @@ ["Rerun" maplev-mint-rerun :active maplev-mint--code-beginning] "---" ("Mint level" - ["severe errors" (setq maplev-mint-info-level 1) :style radio :selected (= maplev-mint-info-level 1)] + ["severe errors" (setq maplev-mint-info-level 1) :style radio :selected (= maplev-mint-info-level 1)] ["+ serious errors" (setq maplev-mint-info-level 2) :style radio :selected (= maplev-mint-info-level 2)] ["+ warnings" (setq maplev-mint-info-level 3) :style radio :selected (= maplev-mint-info-level 3)] - ["full report" (setq maplev-mint-info-level 4) :style radio :selected (= maplev-mint-info-level 4)])) + ["full report" (setq maplev-mint-info-level 4) :style radio :selected (= maplev-mint-info-level 4)])) ("Maple" ["Goto buffer" maplev-cmaple-pop-to-buffer t] ["Send buffer" maplev-cmaple-send-buffer t] @@ -1483,8 +1546,12 @@ ["Enable abbrevs" abbrev-mode :style toggle :selected abbrev-mode] ["List abbrevs" maplev-abbrev-help t]) - ["Enable auto fill" auto-fill-mode - :style toggle :selected auto-fill-function] + ["Enable auto-fill comments" (setq maplev-auto-fill-comment-flag (not maplev-auto-fill-comment-flag)) + :style toggle :selected maplev-auto-fill-comment-flag] + ["Enable auto-string break" (setq maplev-auto-break-strings-flag (not maplev-auto-break-strings-flag)) + :style toggle :selected maplev-auto-break-strings-flag] + ["Use leading commas" (setq maplev-leading-comma-flag (not maplev-leading-comma-flag)) + :style toggle :selected maplev-leading-comma-flag] ("Decoration" ,@maplev--menu-decoration)) "---" ["Add Index" maplev-add-imenu (not (and (boundp 'imenu--index-alist) @@ -1553,15 +1620,16 @@ ;;}}} ;;{{{ Imenu support + ;; Index all the procedure assignments. Other possiblities to index ;; are global variable assignments, macros and aliases; however, ;; selecting them is difficult. (defvar maplev-imenu-generic-expression - `(("Procedures" ,maplev--defun-begin-re 1) - ("Variables" ,(concat "^\\(" maplev--name-re "\\)" + `(("Procedures" ,maplev--defun-begin-re 2) + ("Modules" ,(concat "^\\(" maplev--name-re "\\)" "[ \t\n]*:=[ \t\n]*" - "\\([^ \t\np]\\|p\\([^r]\\|r\\([^o]\\|o\\([^c]\\|c[^ \t\n(]\\)\\)\\)\\)") 1) + "module") 1) ("Macros" ,(concat "^macro([ \t]*\\([^ \t=]*\\)") 1)) "Imenu expression for MapleV mode. See `imenu-generic-expression'.") @@ -1587,6 +1655,7 @@ Check whether `folding-mode' is active." (if folding-mode (folding-open-buffer)) (imenu-default-create-index-function)) + ;;}}} ;;{{{ Buffer edit functions @@ -1639,9 +1708,9 @@ (looking-at "#+[\t ]*") (setq comment-fill-prefix (concat (if indent-tabs-mode - (progn - (make-string (/ (current-column) tab-width) ?\t) - (make-string (% (current-column) tab-width) ?\ )) + (concat + (make-string (/ (current-column) tab-width) ?\t) + (make-string (% (current-column) tab-width) ?\ )) (make-string (current-column) ?\ )) (buffer-substring (match-beginning 0) (match-end 0)))) (save-restriction @@ -1690,27 +1759,19 @@ nil (re-search-forward comment-start-skip) (point))))))) - t))) + t))) ; return non-nil so fill-paragraph knows this succeeded ;;}}} ;;{{{ Info ;; This must go elsewhere (in maplev-mode). -;; (put 'maplev 'info-file "maplev") - -;;(info 'maplev) (defun maplev-goto-info-node () "Go to the info node for maplev." (interactive) (require 'info) - (let ((where (save-window-excursion - (Info-find-emacs-command-nodes 'maplev)))) - (if (not where) - (error "Could not find info file for maplev") - (let (same-window-buffer-names) - (info)) - (Info-find-node (car (car where)) (car (cdr (car where))))))) + (info "maplev")) + ;;}}} ;;{{{ MapleV mode @@ -1797,6 +1858,7 @@ (set (make-local-variable 'require-final-newline) t) (auto-fill-mode (if maplev-auto-fill-comment-flag 1 0)) + (setq auto-fill-function 'maplev-auto-fill) ;; indentation (set (make-local-variable 'indent-line-function) 'maplev-indent-line) @@ -1804,12 +1866,15 @@ (set (make-local-variable 'tab-width) maplev-indent-level) (set (make-local-variable 'indent-tabs-mode) nil) + (ad-activate 'fixup-whitespace) + ;; abbrev expansion (abbrev-mode (if maplev-initial-abbrev-mode-flag 1 0)) ;; comments (set (make-local-variable 'comment-start) maplev-comment-start) - (set (make-local-variable 'block-comment-start) maplev-block-comment-start) +;; (if (< emacs-major-version 22) +;; (set (make-local-variable 'block-comment-start) maplev-block-comment-start)) (set (make-local-variable 'comment-end) "") (set (make-local-variable 'comment-start-skip) "#+[ \t]*") (set (make-local-variable 'comment-column) maplev-comment-column) @@ -1819,8 +1884,8 @@ (and maplev-menu (easy-menu-add maplev-menu)) ;; imenu - (set (make-local-variable 'imenu-default-create-index-function) - 'maplev--imenu-create-index-function) + (set (make-local-variable 'imenu-create-index-function) + #'maplev--imenu-create-index-function) (set (make-local-variable 'imenu-default-goto-function) 'maplev--imenu-goto-function) (set (make-local-variable 'imenu-generic-expression) @@ -1853,19 +1918,22 @@ ;; the file's local variables specs might change maplev-release ;; xemacs version of make-local-hook returns t, not the hook. (JR) ;; make-local-hook is obsolete in GNU emacs 21.1 - (make-local-hook 'hack-local-variables-hook) + ;;(make-local-hook 'hack-local-variables-hook) (add-hook 'hack-local-variables-hook 'maplev-mode-name nil t) + (if maplev-buttonize-includes-flag (maplev-buttonize-includes)) + (if maplev-load-config-file-flag (maplev-load-config-file)) + ;; Set hooks (if maplev-clean-buffer-before-saving-flag (add-hook 'local-write-file-hooks 'maplev-remove-trailing-spaces)) - (make-local-hook 'before-change-functions) + ;;(make-local-hook 'before-change-functions) (add-hook 'before-change-functions 'maplev--before-change-function nil t) (run-hooks 'maplev-mode-hook)) (defun maplev-mode-name () "Set `mode-name' in `maplev-mode' according to `maplev-release'." - (setq mode-name (concat "Maple R" maplev-release))) + (setq mode-name (format "Maple %s" maplev-release))) ;;}}} @@ -1905,7 +1973,8 @@ (newline) ; should we indent? (let ((indent (maplev--comment-line-indentation -1))) (and indent (indent-to indent))) - (insert block-comment-start)) + (insert maplev-block-comment-start) + ) (defun maplev--comment-line-indentation (&optional n) @@ -2060,6 +2129,22 @@ (let ((reg (maplev-current-defun))) (narrow-to-region (car reg) (nth 1 reg)))) + +(defun maplev-what-proc (&optional nodisplay) + "Display and return the name of the current procedure. +If optional NODISPLAY is non-nil, just return the string." + (interactive) + (save-restriction + (save-excursion + (widen) + (end-of-line) + (maplev-beginning-of-defun) + (re-search-forward maplev--assignment-re) + (let ((proc (match-string-no-properties 1))) + (if nodisplay + proc + (message proc)))))) + ;;; stuff used by mint (defun maplev--re-search-forward (regexp &optional bound noerror count) @@ -2132,9 +2217,9 @@ (defun maplev--statement-terminator () "Buffer position immediately following next non-comment semicolon or -colon that is not part of a double colon." +colon that is not part of a double colon, colon-dash, or colon-equals." (save-excursion - (maplev--re-search-forward "[^:]\\(;\\|:[^:]\\)" nil t) + (maplev--re-search-forward "[^:]\\(;\\|:[^-:=]\\)" nil t) (+ 1 (match-beginning 1)))) (defun maplev--goto-declaration (keyword) @@ -2151,16 +2236,31 @@ (concat "\\<" keyword "\\>") bound t)) (goto-char (match-beginning 0))))) -(defun maplev-add-declaration (keyword var) + +(defun maplev-add-declaration-one-line (keyword var) "To the current procedure's KEYWORD declaration add VAR. If necessary, add a KEYWORD statement. Point must be after the closing parenthesis of the procedure's argument list." (save-excursion (if (maplev--goto-declaration keyword) - (progn - (goto-char (maplev--statement-terminator)) - (backward-char) - (insert "," (make-string maplev-variable-spacing ?\ ) var)) + (let ((end (maplev--statement-terminator))) + (if maplev-alphabetize-declarations-p + (progn + (forward-word) + (while (and (< (point) end) + (looking-at (concat "\\s-*\\(" maplev--symbol-re "\\) *,?")) + (string< (match-string-no-properties 1) var)) + ;; Move over symbol and, if there, comma. For now + ;; assume that the symbols do not have + ;; types---including types in-line seems bad form. + ;; Moving across a type is fairly tricky. + (goto-char (match-end 0))) + (if (looking-at " *;") + (insert (format ", %s" var)) + (insert (format " %s," var)))) + (goto-char end) + (backward-char) + (insert "," (make-string maplev-variable-spacing ?\ ) var))) (let (stay) ;; Declarations are ordered: local, global, export (if (maplev--goto-declaration "local") @@ -2185,12 +2285,155 @@ (forward-line -1))) (maplev-indent-line)))) -(defun maplev-add-local-variable (var) +(defun maplev-add-declaration-leading-comma (keyword var) + "To the current procedure's KEYWORD declaration add VAR. +If necessary, add a KEYWORD statement. Point must be after the +closing parenthesis of the procedure's argument list. Optional +TYPE specifies the declared type of VAR. The string +`maplev-var-declaration-symbol' is used as the declaration +symbol; it is inserted between VAR and TYPE. + +If `maplev-alphabetize-declarations-p' is non-nil, VAR is +inserted alphabetically into the sequence of existing +declarations, otherwise it is inserted at the end." + (save-excursion + (if (maplev--goto-declaration keyword) + (let ((end (maplev--statement-terminator))) + (if maplev-alphabetize-declarations-p + (progn + (forward-word) + (while (and (< (point) end) + (looking-at (concat "\\s-*\\(?:, \\)?\\(" maplev--symbol-re "\\)")) + (string< (match-string-no-properties 1) var)) + (forward-line)) + (if (looking-at "\\s-*[,;]") + (progn + (insert (format ", %s" var)) + (maplev-indent-newline)) + (insert (format " %s" var)) + (maplev-indent-newline) + (insert ", "))) + ;; Insert `, VAR' before terminator. + (goto-char end) + (forward-line 0) + (insert (format ", %s" var)) + (maplev-indent-newline))) + (let (stay) + ;; Declarations are ordered: local, global, export + (if (maplev--goto-declaration "local") + (setq stay (goto-char (maplev--statement-terminator)))) + (if (maplev--goto-declaration "global") + (setq stay (goto-char (maplev--statement-terminator)))) + ;; Position point and text in preparation for inserting a + ;; declaration statement. + (if (not (looking-at "[ \t]*\\(#.*\\)?$")) ; More code on line? + (just-one-space) ; Then insert declaration inbetween. + (forward-line) ; Else move to the next code line. + (unless stay ; Keep moving if we not already + (while (looking-at "[ \t]*#") ; have a declaration. + (forward-line))))) + ;; Insert the declaration statement KEYWORD VAR\n; at point. + (insert (format " %s %s" keyword var)) + (maplev-indent-newline) + (insert ";") + (maplev-indent-newline)))) + +(defun maplev-add-declaration-trailing-comma (keyword var) + "To the current procedure's KEYWORD declaration add VAR. +If necessary, add a KEYWORD statement. Point must be after the +closing parenthesis of the procedure's argument list. Optional +TYPE specifies the declared type of VAR. The string +`maplev-var-declaration-symbol' is used as the declaration +symbol; it is inserted between VAR and TYPE. + +If `maplev-alphabetize-declarations-p' is non-nil, VAR is +inserted alphabetically into the sequence of existing +declarations, otherwise it is inserted at the end." + (save-excursion + (if (maplev--goto-declaration keyword) + (let ((end (maplev--statement-terminator))) + (if maplev-alphabetize-declarations-p + (progn + (forward-line) + (while (and (< (point) end) + (looking-at (concat "\\s-*\\(" maplev--symbol-re "\\)")) + (string< (match-string-no-properties 1) var)) + (forward-line)) + (if (< (point) end) + (insert (format "%s," var)) + (forward-line -1) + (re-search-forward ";" (line-end-position)) + (replace-match ",") + (forward-line) + (insert (format "%s;" var))) + (maplev-indent-newline)) + ;; Replace terminator with comma. + ;; Preserve comments following terminator. + (goto-char end) + (delete-char -1) + (insert ",") + (end-of-line) + ;; Insert VAR with terminator. + (newline) + (insert (format "%s;" var)) + (maplev-indent-line))) + (let (stay) + ;; Declarations are ordered: local, global, export + (if (maplev--goto-declaration "local") + (setq stay (goto-char (maplev--statement-terminator)))) + (if (maplev--goto-declaration "global") + (setq stay (goto-char (maplev--statement-terminator)))) + ;; Position point and text in preparation for inserting a + ;; declaration statement. + (if (not (looking-at "[ \t]*\\(#.*\\)?$")) ; More code on line? + (just-one-space) ; Then insert declaration inbetween. + (forward-line) ; Else move to the next code line. + (unless stay ; Keep moving if we not already + (while (looking-at "[ \t]*#") ; have a declaration. + (forward-line))))) + ;; Insert the declaration statement KEYWORD VAR ; at point. + ;; If point is at beginning of line, insert a newline at end. + ;; NOTE: It might be better to look whether there is any following text. + (if (bolp) + (progn + (insert keyword) + (maplev-indent-line) + (newline) + (insert (format "%s;" var)) + (newline) + (forward-line -1)) + (insert (format " %s %s;" keyword var) )) + (maplev-indent-line)))) + +(defun maplev-add-declaration (keyword var &optional type) + "To the KEYWORD declaration of current procedure, add VAR. +If non-nil, optional TYPE is catenated to VAR and +`maplev-var-declaration-symbol'. The function assigned to +`maplev-add-declaration-function' does the work." + (funcall maplev-add-declaration-function keyword + (if type + (concat var maplev-var-declaration-symbol type) + var))) + +(defun maplev-add-local-variable (var &optional type) "Add VAR to the current procedure's local statement. Interactively, VAR defaults to identifier point is on." (interactive (list (maplev-ident-around-point-interactive - "Local variable"))) - (maplev-add-variable "local" var)) + "Local variable") + ;; Query type unless all declarations go on one line. + ;; It seems bad from to use types one one-line; regardless, + ;; `maplev-add-declaration-one-line' currently does not + ;; handle types. + (unless (equal maplev-add-declaration-function 'maplev-add-declaration-one-line) + (let ((type (read-string + "Type (empty for no type): " + nil + maplev--declaration-history))) + (if (equal "" type) + nil + type))))) + (maplev-add-variable "local" var type)) + (defun maplev-add-global-variable (var) "Add VAR to the current procedure's local statement. @@ -2206,12 +2449,12 @@ "Exported variable"))) (maplev-add-variable "export" var)) -(defun maplev-add-variable (keyword var) +(defun maplev-add-variable (keyword var &optional type) "To the current procedure's KEYWORD declaration add VAR." (save-excursion (maplev-beginning-of-defun) (goto-char (maplev--scan-lists 1)) - (maplev-add-declaration keyword var))) + (maplev-add-declaration keyword var type))) (defun maplev-delete-declaration (keyword vars &optional leave-one) "From the KEYWORD declaration delete occurrences of VARS. @@ -2306,6 +2549,112 @@ (setq vars (cdr vars))))))) ;;}}} + +;;{{{ Folding functions + +(with-no-warnings + (defun maplev-fold-proc () + "Add editor fold marks around the procedure at point. +The name of the procedure is inserted into the title of the fold." + (interactive) + (let ((proc (maplev-what-proc 'nodisplay))) + (maplev-mark-defun) + (folding-fold-region (point) (mark)) + (insert (concat " " proc)) + (folding-shift-out)))) + +;;}}} + +;;{{{ Movement functions + +(defconst maplev--operator-re + (concat "\\(?:" + (regexp-opt + '(":-" + "||" + "::" + "!" + "^" "@@" + "." "*" "&*" "/" "@" "intersect" + "mod" + "+" "-" "union" "minus" + ".." "subset" + "<" "<=" ">" ">=" "=" "<>" "in" + "$" + "not" + "and" + "or" + "xor" + "implies" + "->" + ;; "," + "assuming" + ;; ":=" + )) + ;; neutral operators + "\\|&\\(?:[~!@$^*-+=\"<>,./?]+\\|[a-zA-Z_][a-zA-Z_0-9]*\\)" + "\\)") + "Regular expression matching a Maple operator." + ) + +(defconst maplev--number-re + "\\=[+-]?\\(?:[0-9]+\\(\\.[0-9]*\\)?\\|\\.[0-9]+\\)\\(?:[Ee][+-]?[0-9]*\\)?" + "Regular expression matching a number. This is slightly too aggressive, +it incorrectly matches, d.Ed, which is invalid.") + +(defconst maplev--expr-re + (concat "\\s-*" + "\\(?:" + maplev--operator-re + "\\|" + maplev--number-re + "\\|" + maplev--symbol-re + "\\|" + maplev--string-re + "\\)" + "\\s-*" + ) + "Regular expression to match a partial expression.") + +(defun maplev-forward-expr () + "Move point forward over a complete expression." + (interactive) + (if + (cond + ((looking-at "\\s-*\\s(") + (forward-sexp) + t) + ((looking-at maplev--expr-re) + (goto-char (match-end 0))) + ((looking-at "\\s-*\\(?:#.*\\)?$") + (forward-line))) + (maplev-forward-expr))) + +;;}}} + +;;{{{ Miscellaneous + +(defun maplev-remove-dupes (list) + "Remove duplicates from a sorted assoc LIST." + (let (tmp-list head) + (while list + (setq head (pop list)) + (unless (equal (car head) (car (car list))) + (push head tmp-list))) + (reverse tmp-list))) + +(defun maplev-minus (setA setB) + "Remove members of SETB from SETA." + (let (tmp head) + (while setA + (setq head (pop setA)) + (unless (member head setB) + (push head tmp))) + (reverse tmp))) + +;;}}} + ;;{{{ Templates (defun maplev--template-proc-module (function name args description) @@ -2380,7 +2729,6 @@ (maplev-indent-line) (forward-line -1) (maplev-indent-line)) - ;;}}} ;;{{{ Completion @@ -2444,14 +2792,11 @@ completions))) ;; Replace the completion alist. (setcar (cdr (assoc maplev-release maplev-completion-alist)) - (remove-duplicates - (sort completions (lambda (a b) (string< (car a) (car b)))) - :test (lambda (a b) (string= (car a) (car b))))))) + (maplev-remove-dupes + (sort completions (lambda (a b) (string< (car a) (car b)))))))) ;; Delete the output from the cmaple buffer. (delete-region (point-min) (point-max))))) -;; (setq maplev-completion-alist nil) - (defun maplev--generate-initial-completion-alist () "Generate `maplev-completion-alist' from the index/function and index/package help pages. If it already exists, do nothing." @@ -2572,6 +2917,63 @@ ;;}}} +;;{{{ Comments to Strings + +(defun maplev-comment-to-string-region (beg end) + "Convert indented comments to strings. +The purpose of this is to embed comments as strings into the source +so that, when using a debugger, the showstat output appears to +be commented. See `maplev-string-to-comment-region'." + (interactive "r") + (save-excursion + (goto-char beg) + (while (re-search-forward "^\\(\\s-+\\)\\(#.*\\)" end t) + (replace-match "\\1\"\\2\";")))) + +(defun maplev-string-to-comment-region (beg end) + "Convert strings back to comments. +This is the inverse of `maplev-comment-to-string-region.'" + (interactive "r") + (save-excursion + (goto-char beg) + (while (re-search-forward "^\\(\\s-+\\)\"\\(#.*\\)\";$" end t) + (replace-match "\\1\\2")))) + +;;}}} + +;;{{{ Auto-fill + +(defun maplev-auto-fill () + "Use this function when `auto-fill-mode' is active in Maple. +If `maplev-auto-break-strings-flag' is non-nil, a string that exceeds +the current column is automatically broken at whitespace, terminated +with a double-colon, and begun again on the next line, with an indent." + (let ((fc (current-fill-column))) + (and fc (<= fc (current-column)) + (if (and + maplev-auto-break-strings-flag + (eq ?\" (nth 3 (parse-partial-sexp (line-beginning-position) (point))))) + (maplev-auto-break-string) + (do-auto-fill))))) + +(defun maplev-auto-break-string () + "Auto-break a string. Must be called where the string is to break. +Inserts double-quote, then calls `mpldoc-indent-newline' to insert an +indented newling. A double-quote is inserted at the indentation point. +If at the end of the line, a closing double-quote is also added and point +moved to be before it." + (insert "\"") + (newline-and-indent) + (insert-char ?\" 1) + (when (eolp) + (insert-char ?\" 1) + (backward-char))) + + + +;;}}} + + ;;{{{ Font lock (defvar maplev-preprocessor-face 'maplev-preprocessor-face @@ -2587,111 +2989,150 @@ :group 'maplev-faces) +;;{{{ reserved words + +(defconst maplev--reserved-words-3 + '("and" "by" "do" "done" "elif" + "else" "end" "fi" "for" "from" + "if" "in" "intersect" "local" "minus" + "mod" "not" "od" "option" "options" + "or" "proc" "quit" "read" "save" + "stop" "then" "to" "union" "while" + "description" "local" "global") + "List of reserved words for Maple V R3") + +(defconst maplev--reserved-words-4 + maplev--reserved-words-3 + "List of reserved words for Maple V4") + +(defconst maplev--reserved-words-5 + maplev--reserved-words-3 + "List of reserved words for Maple V5") + +(defconst maplev--reserved-words-6 + (append '("break" "catch" "error" "export" "finally" + "in" "module" "next" "return" "try" "use") + maplev--reserved-words-5) + "List of reserved words for Maple 6") + +(defconst maplev--reserved-words-7 + (append '("assuming" "implies" "subset" "xor") + maplev--reserved-words-6) + "List of reserved words for Maple 7") + +(defconst maplev--reserved-words-8 + maplev--reserved-words-7 + "List of reserved words for Maple 8") + +(defconst maplev--reserved-words-9 + maplev--reserved-words-7 + "List of reserved words for Maple 9") + +(defconst maplev--reserved-words-10 + (append '("uses") + maplev--reserved-words-7) + "List of reserved words for Maple 10") + +(defconst maplev--reserved-words-11 + maplev--reserved-words-10 + "List of reserved words for Maple 11") + +(defconst maplev--reserved-words-12 + maplev--reserved-words-10 + "List of reserved words for Maple 12") + +(defconst maplev--reserved-words-13 + maplev--reserved-words-10 + "List of reserved words for Maple 13") + +(defconst maplev--reserved-words-14 + maplev--reserved-words-10 + "List of reserved words for Maple 14") + +(defconst maplev--reserved-words-15 + maplev--reserved-words-10 + "List of reserved words for Maple 15") + +(defconst maplev--reserved-words-16 + maplev--reserved-words-10 + "List of reserved words for Maple 16") + (defconst maplev--reserved-words-alist - '((3 . ("and" "by" "do" "done" "elif" - "else" "end" "fi" "for" "from" - "if" "in" "intersect" "local" "minus" - "mod" "not" "od" "option" "options" - "or" "proc" "quit" "read" "save" - "stop" "then" "to" "union" "while" - "description" "local" "global")) - (4 . ("and" "by" "do" "done" "elif" - "else" "end" "fi" "for" "from" - "if" "in" "intersect" "local" "minus" - "mod" "not" "od" "option" "options" - "or" "proc" "quit" "read" "save" - "stop" "then" "to" "union" "while" - "description" "local" "global")) - (5 . ("and" "by" "do" "done" "elif" - "else" "end" "fi" "for" "from" - "if" "in" "intersect" "local" "minus" - "mod" "not" "od" "option" "options" - "or" "proc" "quit" "read" "save" - "stop" "then" "to" "union" "while" - "description" "local" "global")) - (6 . ("and" "break" "by" "catch" "description" "do" "done" - "elif" "else" "end" "error" "export" "fi" "finally" - "for" "from" "global" "if" "in" "intersect" "local" - "minus" "mod" "module" "next" "not" "od" "option" - "options" "or" "proc" "quit" "read" "return" "save" - "stop" "then" "to" "try" "union" "use" "while")) - (7 . ("and" "assuming" "break" "by" "catch" - "description" "do" "done" "elif" "else" - "end" "error" "export" "fi" "finally" - "for" "from" "global" "if" "implies" - "in" "intersect" "local" "minus" "mod" - "module" "next" "not" "od" "option" - "options" "or" "proc" "quit" "read" - "return" "save" "stop" "subset" "then" - "to" "try" "union" "use" "while" - "xor")) - (8 . ("and" "assuming" "break" "by" "catch" - "description" "do" "done" "elif" "else" - "end" "error" "export" "fi" "finally" - "for" "from" "global" "if" "implies" - "in" "intersect" "local" "minus" "mod" - "module" "next" "not" "od" "option" - "options" "or" "proc" "quit" "read" - "return" "save" "stop" "subset" "then" - "to" "try" "union" "use" "while" - "xor")) - (9 . ("and" "assuming" "break" "by" "catch" - "description" "do" "done" "elif" "else" - "end" "error" "export" "fi" "finally" - "for" "from" "global" "if" "implies" - "in" "intersect" "local" "minus" "mod" - "module" "next" "not" "od" "option" - "options" "or" "proc" "quit" "read" - "return" "save" "stop" "subset" "then" - "to" "try" "union" "use" "while" - "xor")) - (10 . ("and" "assuming" "break" "by" "catch" - "description" "do" "done" "elif" "else" - "end" "error" "export" "fi" "finally" - "for" "from" "global" "if" "implies" - "in" "intersect" "local" "minus" "mod" - "module" "next" "not" "od" "option" - "options" "or" "proc" "quit" "read" - "return" "save" "stop" "subset" "then" - "to" "try" "union" "use" "uses" "while" - "xor")) - (11 . ("and" "assuming" "break" "by" "catch" - "description" "do" "done" "elif" "else" - "end" "error" "export" "fi" "finally" - "for" "from" "global" "if" "implies" - "in" "intersect" "local" "minus" "mod" - "module" "next" "not" "od" "option" - "options" "or" "proc" "quit" "read" - "return" "save" "stop" "subset" "then" - "to" "try" "union" "use" "uses" "while" - "xor")) - ) + `((3 . ,maplev--reserved-words-3) + (4 . ,maplev--reserved-words-4) + (5 . ,maplev--reserved-words-5) + (6 . ,maplev--reserved-words-6) + (7 . ,maplev--reserved-words-7) + (8 . ,maplev--reserved-words-8) + (9 . ,maplev--reserved-words-9) + (10 . ,maplev--reserved-words-10) + (11 . ,maplev--reserved-words-11) + (12 . ,maplev--reserved-words-12) + (13 . ,maplev--reserved-words-13) + (14 . ,maplev--reserved-words-14) + (15 . ,maplev--reserved-words-15) + (16 . ,maplev--reserved-words-16) + ) "Alist of Maple reserved words. The key is the major release.") -(defconst maplev--special-words-re +;;}}} + +(defconst maplev--deprecated-re (eval-when-compile (maplev--list-to-word-re - (list "args" "nargs" "procname" "RootOf" "Float" "thismodule"))) + (list "fi" "od" "traperror" "linalg" "solvefor" "ERROR"))) + "Regex of deprecated keywords and procedures.") + +(defconst maplev--special-words + (list "args" "nargs" "procname" "RootOf" "Float" "thismodule" "thisproc" + "_options" "_noptions" "_rest" "_nrest" + "_params" "_nparams" "_passed" "_npassed" + "_nresults" "static" ) + "List of special words in Maple.") + +(defconst maplev--special-words-re + (maplev--list-to-word-re maplev--special-words) "Regex of special words in Maple.") +(defconst maplev--initial-variables + (list "Catalan" "true" "false" "FAIL" "infinity" "Pi" "gamma" + "integrate" "libname" "NULL" "Order" "printlevel" "lasterror" "lastexception" + "`mod`" "Digits" "constants" "undefined" "I" + "UseHardwareFloats" + "Testzero" "Normalizer" "NumericEventHandlers" + "Rounding" "`index/newtable`") + "List of global, environmental variables, and constants.") + (defconst maplev--initial-variables-re - (eval-when-compile - (maplev--list-to-word-re - (list "Catalan" "true" "false" "FAIL" "infinity" "Pi" "gamma" - "integrate" "libname" "NULL" "Order" "printlevel" "lasterror" - "`mod`" "Digits" "constants" "undefined" "I" - "UseHardwareFloats" - "Testzero" "Normalizer" "NumericEventHandlers" - "Rounding" "`index/newtable`"))) + (maplev--list-to-word-re maplev--initial-variables) "Regexp of global, environmental variables and constants.") (defconst maplev--preprocessor-directives-re (eval-when-compile - (concat "^\\$\\(" - (regexp-opt (list "include" "define" "undef" "ifdef" "ifndef" "else" "endif" )) + (concat "^\\$\\(" + (regexp-opt (list + "define" + "elif" + "else" + "endif" + "file" + "ifdef" + "ifndef" + "include" + "undef" + )) "\\)")) "Regex of preprocessor directives.") +(defconst maplev--include-directive-re + "^\\(?:## \\)?\\$include\\s-+\\([<\"]\\)\\(.*\\)[>\"]" + "Regex of an include directive. The first group matches +the character used to delimit the file (either < or \"). +The second group matches the filename.") + + +;;{{{ builtins + ;; Currently the backquoted builtin functions are font-locked as ;; quoted names rather than as builtin functions. Fixing this ;; requires pulling them out. @@ -2718,295 +3159,112 @@ "tabular" "uneval" "zppoly"))) "Alist of builtin Maple types. Currently not used.") +(defconst maplev--builtin-functions-3 + '("`$`" "ERROR" "Im" "RETURN" "Re" "SearchText" + "abs" "addressof" "alias" "anames" "appendto" "array" "assemble" "assigned" + "callback" "cat" "coeff" "coeffs" "convert" "debugopts" + "degree" "diff" "disassemble" "divide" + "entries" "eval" "evalb" "evalf" "`evalf/hypergeom`" "evalhf" "evaln" "expand" + "frontend" "gc" "genpoly" "goto" "has" "hastype" + "icontent" "`if`" "igcd" "ilog10" "indets" "indices" "intersect" "`int/series`" "iquo" "irem" "isqrt" + "lcoeff" "ldegree" "length" "lexorder" "lprint" + "macro" "map" "max" "maxnorm" "member" "min" "`minus`" "modp" "modp1" "mods" + "nops" "normal" "numboccur" "numer" "op" "order" "parse" "pointto" "print" "printf" "protect" + "readlib" "readline" "searchtext" "select" "seq" "series" "sign" "sort" "sscanf" "ssystem" "subs" "subsop" "substring" "system" + "table" "taylor" "tcoeff" "time" "traperror" "trunc" "type" + "unames" "`union`" "unprotect" "userinfo" "words" "writeto" )) + +(defconst maplev--builtin-functions-4 + (append '("`*`" "`+`" "ASSERT" "DEBUG" "MorrBrilCull" "add" "attributes" "denom" "getuserinterface" "inner" "iolib" "kernelopts" "`kernel/transpose`" "map2" "mul" "setattribute" "setuserinterface" "typematch") + (maplev-minus maplev--builtin-functions-3 + '("printf" "protect" "readline" "setattribute" "setuserinterface" "sscanf" "unprotect" "words")))) + + +(defconst maplev--builtin-functions-5 + (append '("`**`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`^`" "call" "crinterp" "define" "`evalf/hypergeom/kernel`" "hfarray" "timelimit") + (remove "`evalf/hypergeom`" maplev--builtin-functions-4))) + +(defconst maplev--builtin-functions-6 + (append '("||" "Array" "ArrayOptions" "CopySign" "Default0" "DefaultOverflow" "DefaultUnderflow" + "EqualEntries" "EqualStructure" "FromInert" "MPFloat" + "NextAfter" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "OrderedNE" + "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "TRACE" "ToInert" "Unordered" + "`and`" "bind" "call_external" "conjugate" "define_external" "`done`" "evalgf1" "exports" "frem" + "ilog2" "lhs" "modp2" "mvMultiply" "negate" "`not`" "`or`" "remove" "rhs" + "rtable" "rtableInfo" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" + "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_scanblock" "rtable_sort_indices" + "selectremove" "`stop`" "streamcall" "unbind") + (maplev-minus maplev--builtin-functions-5 + '("call" "define" "getuserinterface" "setuserinterface")))) + + +(defconst maplev--builtin-functions-7 + (append '("_treeMatch" "_unify" "_xml" "dlclose" "factorial" "`implies`" "`subset`" "`xor`") + maplev--builtin-functions-6)) + +(defconst maplev--builtin-functions-8 + (append '("_jvm" "_maplet" "andmap" "ormap") + maplev--builtin-functions-7)) + +(defconst maplev--builtin-functions-9 + (append '("`..`" "Normalizer" "UpdateSource" "gmp_isprime" "is_gmp" "isqrt" "`mod`" "piecewise" "reduce_opr" "rtable_eval" "rtable_zip") + maplev--builtin-functions-8)) + +(defconst maplev--builtin-functions-10 + (append '("`?()`" "`?[]`" "`{}`" "`[]`" "SDMPolynom" "overload" "rtable_convolution" "rtable_redim" "rtable_scale" "savelib") + maplev--builtin-functions-9)) + +(defconst maplev--builtin-functions-11 + maplev--builtin-functions-10) + +(defconst maplev--builtin-functions-12 + (append '("Record" "rtable_size") maplev--builtin-functions-11)) + +(defconst maplev--builtin-functions-13 + (append '("`::`" "`~`") maplev--builtin-functions-12)) + +(defconst maplev--builtin-functions-14 + (append '("Object") maplev--builtin-functions-13)) + +(defconst maplev--builtin-functions-15 + (append '("assign" "numelems" "upperbound" "lowerbound") maplev--builtin-functions-14)) + +(defconst maplev--builtin-functions-16 + (append '("_hackwareToPointer") maplev--builtin-functions-15)) + (defconst maplev--builtin-functions-alist - '((3 . ("`$`" "ERROR" "Im" "RETURN" "Re" "SearchText" - "abs" "addressof" "alias" "anames" "appendto" - "array" "assemble" "assigned" "callback" "cat" - "coeff" "coeffs" "convert" "debugopts" "degree" - "diff" "disassemble" "divide" "entries" "eval" - "evalb" "evalf" "`evalf/hypergeom`" "evalhf" "evaln" - "expand" "frontend" "gc" "genpoly" "goto" - "has" "hastype" "icontent" "`if`" "igcd" - "ilog10" "indets" "indices" "`int/series`" "intersect" - "iquo" "irem" "isqrt" "lcoeff" "ldegree" - "length" "lexorder" "lprint" "macro" "map" - "max" "maxnorm" "member" "min" "minus" - "modp" "modp1" "mods" "nops" "normal" - "numboccur" "numer" "op" "order" "parse" - "pointto" "print" "printf" "protect" "readlib" - "readline" "searchtext" "select" "seq" "series" - "sign" "sort" "sscanf" "ssystem" "subs" - "subsop" "substring" "system" "table" "taylor" - "tcoeff" "time" "traperror" "trunc" "type" - "unames" "`union`" "unprotect" "userinfo" "words" - "writeto" )) - (4 . ("`$`" "`*`" "`+`" "ASSERT" "DEBUG" - "ERROR" "Im" "MorrBrilCull" "RETURN" "Re" - "SearchText" "abs" "add" "addressof" "alias" - "anames" "appendto" "array" "assemble" "assigned" - "attributes" "callback" "cat" "coeff" "coeffs" - "convert" "debugopts" "degree" "denom" "diff" - "disassemble" "divide" "entries" "eval" "evalb" - "evalf" "`evalf/hypergeom`" "evalhf" "evaln" "expand" - "frontend" "gc" "genpoly" "getuserinterface" "goto" - "has" "hastype" "icontent" "`if`" "igcd" - "ilog10" "indets" "indices" "inner" "`int/series`" - "intersect" "iolib" "iquo" "irem" "isqrt" - "`kernel/transpose`" "kernelopts" "lcoeff" "ldegree" "length" - "lexorder" "lprint" "macro" "map" "map2" - "max" "maxnorm" "member" "min" "minus" - "modp" "modp1" "mods" "mul" "nops" - "normal" "numboccur" "numer" "op" "order" - "parse" "pointto" "print" "readlib" "searchtext" - "select" "seq" "series" "setattribute" "setuserinterface" - "sign" "sort" "ssystem" "subs" "subsop" - "substring" "system" "table" "taylor" "tcoeff" - "time" "traperror" "trunc" "type" "typematch" - "unames" "`union`" "userinfo" "writeto")) - (5 . ("`$`" "`*`" "`**`" "`+`" "`<`" - "`<=`" "`<>`" "`=`" "`>`" "`>=`" - "`^`" "ASSERT" "DEBUG" "ERROR" "Im" - "MorrBrilCull" "RETURN" "Re" "SearchText" "abs" - "add" "addressof" "alias" "anames" "appendto" - "array" "assemble" "assigned" "attributes" "call" - "callback" "cat" "coeff" "coeffs" "convert" - "crinterp" "debugopts" "define" "degree" "denom" - "diff" "disassemble" "divide" "entries" "eval" - "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalhf" "evaln" - "expand" "frontend" "gc" "genpoly" "getuserinterface" - "goto" "has" "hastype" "hfarray" "icontent" - "`if`" "igcd" "ilog10" "indets" "indices" - "inner" "`int/series`" "intersect" "iolib" "iquo" - "irem" "isqrt" "`kernel/transpose`" "kernelopts" "lcoeff" - "ldegree" "length" "lexorder" "lprint" "macro" - "map" "map2" "max" "maxnorm" "member" - "min" "minus" "modp" "modp1" "mods" - "mul" "nops" "normal" "numboccur" "numer" - "op" "order" "parse" "pointto" "print" - "readlib" "searchtext" "select" "seq" "series" - "setattribute" "setuserinterface" "sign" "sort" "ssystem" - "subs" "subsop" "substring" "system" "table" - "taylor" "tcoeff" "time" "timelimit" "traperror" - "trunc" "type" "typematch" "unames" "`union`" - "userinfo" "writeto")) - (6 . ("`^`" "`||`" "`$`" "`*`" "`**`" "`+`" - "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" - "ASSERT" "Array" "ArrayOptions" "CopySign" - "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" - "ERROR" "EqualEntries" "EqualStructure" "FromInert" - "Im" "MPFloat" "MorrBrilCull" "NextAfter" - "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" - "OrderedNE" "RETURN" "Re" - "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" - "TRACE" "ToInert" "Unordered" - "abs" "add" "addressof" "alias" "anames" "and" "appendto" "array" - "assemble" "assigned" "attributes" "bind" - "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" - "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" - "inner" "divide" "done" "entries" "eval" "evalb" - "evalf" "evalgf1" "evalhf" "evaln" "expand" "exports" - "frem" "frontend" "gc" "genpoly" "goto" - "has" "hastype" "hfarray" "`evalf/hypergeom/kernel`" - "icontent" "if" "igcd" "ilog10" "ilog2" "indets" "indices" - "intersect" "`int/series`" "iolib" "iquo" "irem" "isqrt" - "kernelopts" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" - "macro" "map" "map2" "max" "maxnorm" "member" "min" "minus" - "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" - "negate" "nops" "normal" "not" "numboccur" "numer" - "op" "or" "order" "parse" "pointto" "print" "quit" - "readlib" "remove" "rhs" "rtable" "rtableInfo" "rtable_indfns" - "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" - "rtable_num_elems" "rtable_options" "rtable_scanblock" - "rtable_sort_indices" "searchtext" "select" "selectremove" - "seq" "series" "setattribute" "sign" "sort" "ssystem" "stop" - "streamcall" "subs" "subsop" "substring" "system" - "table" "taylor" "tcoeff" "time" "timelimit" - "`kernel/transpose`" "traperror" "trunc" "type" "typematch" - "unames" "unbind" "union" "userinfo" "writeto")) - (7 . ("`$`" "`*`" "`**`" "`+`" "`<`" "`<=`" - "`<>`" "`=`" "`>`" "`>=`" "`^`" "`||`" - "ASSERT" "Array" "ArrayOptions" "CopySign" - "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" - "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" - "MPFloat" "MorrBrilCull" "NextAfter" "NumericClass" "NumericEvent" - "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" - "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" - "TRACE" "ToInert" "Unordered" "_treeMatch" "_unify" - "_xml" "`evalf/hypergeom/kernel`" "`int/series`" "`kernel/transpose`" - "abs" "add" "addressof" "alias" "anames" "and" - "appendto" "array" "assemble" "assigned" "attributes" - "bind" "call_external" "callback" "cat" "coeff" - "coeffs" "conjugate" "convert" "crinterp" "debugopts" - "define_external" "degree" "denom" "diff" "disassemble" - "divide" "dlclose" "done" "entries" "eval" - "evalb" "evalf" "evalgf1" "evalhf" "evaln" - "expand" "exports" "factorial" "frem" "frontend" - "gc" "genpoly" "goto" "has" "hastype" - "hfarray" "icontent" "if" "igcd" "ilog10" - "ilog2" "implies" "indets" "indices" "inner" - "intersect" "iolib" "iquo" "irem" "isqrt" - "kernelopts" "lcoeff" "ldegree" "length" "lexorder" - "lhs" "lprint" "macro" "map" "map2" - "max" "maxnorm" "member" "min" "minus" - "modp" "modp1" "modp2" "mods" "mul" - "mvMultiply" "negate" "nops" "normal" "not" - "numboccur" "numer" "op" "or" "order" - "parse" "pointto" "print" "quit" "readlib" - "remove" "rhs" "rtable" "rtableInfo" "rtable_indfns" - "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" - "rtable_num_elems" "rtable_options" "rtable_scanblock" - "rtable_sort_indices" "searchtext" "select" "selectremove" - "seq" "series" "setattribute" "sign" "sort" "ssystem" - "stop" "streamcall" "subs" "subset" "subsop" "substring" - "system" "table" "taylor" "tcoeff" "time" "timelimit" - "traperror" "trunc" "type" "typematch" "unames" "unbind" - "union" "userinfo" "writeto" "xor" )) - (8 . ("`$`" "`*`" "`**`" "`+`" "`<`" "`<=`" - "`<>`" "`=`" "`>`" "`>=`" "`^`" "`||`" - "ASSERT" "Array" "ArrayOptions" "CopySign" - "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" - "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" - "MPFloat" "MorrBrilCull" "NextAfter" "NumericClass" "NumericEvent" - "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" - "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" - "TRACE" "ToInert" "Unordered" "_jvm" "_maplet" "_treeMatch" "_unify" - "_xml" "`evalf/hypergeom/kernel`" "`int/series`" "`kernel/transpose`" - "abs" "add" "addressof" "alias" "anames" "and" "andmap" - "appendto" "array" "assemble" "assigned" "attributes" - "bind" "call_external" "callback" "cat" "coeff" - "coeffs" "conjugate" "convert" "crinterp" "debugopts" - "define_external" "degree" "denom" "diff" "disassemble" - "divide" "dlclose" "done" "entries" "eval" - "evalb" "evalf" "evalgf1" "evalhf" "evaln" - "expand" "exports" "factorial" "frem" "frontend" - "gc" "genpoly" "goto" "has" "hastype" - "hfarray" "icontent" "if" "igcd" "ilog10" - "ilog2" "implies" "indets" "indices" "inner" - "intersect" "iolib" "iquo" "irem" "isqrt" - "kernelopts" "lcoeff" "ldegree" "length" "lexorder" - "lhs" "lprint" "macro" "map" "map2" - "max" "maxnorm" "member" "min" "minus" - "modp" "modp1" "modp2" "mods" "mul" - "mvMultiply" "negate" "nops" "normal" "not" - "numboccur" "numer" "op" "or" "order" "ormap" - "parse" "pointto" "print" "quit" "readlib" - "remove" "rhs" "rtable" "rtableInfo" "rtable_indfns" - "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" - "rtable_num_elems" "rtable_options" "rtable_scanblock" - "rtable_sort_indices" "searchtext" "select" "selectremove" - "seq" "series" "setattribute" "sign" "sort" "ssystem" - "stop" "streamcall" "subs" "subset" "subsop" "substring" - "system" "table" "taylor" "tcoeff" "time" "timelimit" - "traperror" "trunc" "type" "typematch" "unames" "unbind" - "union" "userinfo" "writeto" "xor" )) - (9 . ("`$`" "`*`" "`**`" "`+`" "`..`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" - "ASSERT" "Array" "ArrayOptions" "CopySign" - "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" - "ERROR" "EqualEntries" "EqualStructure" "FromInert" - "Im" "MPFloat" "MorrBrilCull" "NextAfter" "Normalizer" - "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" - "OrderedNE" "RETURN" "Re" "SFloatExponent" "SFloatMantissa" - "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" - "Unordered" "UpdateSource" "`^`" - "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" - "abs" "add" "addressof" "alias" "anames" "and" "andmap" - "appendto" "array" "assemble" "assigned" "attributes" - "bind" "call_external" "callback" "cat" "coeff" "coeffs" - "conjugate" "convert" "crinterp" "debugopts" "define_external" - "degree" "denom" "diff" "disassemble" "divide" "dlclose" "done" - "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" - "evalgf1" "evalhf" "evaln" "expand" "exports" "factorial" "frem" - "frontend" "gc" "genpoly" "gmp_isprime" "goto" "has" "hastype" "hfarray" - "icontent" "if" "igcd" "ilog10" "ilog2" "implies" "indets" - "indices" "inner" "`int/series`" "intersect" "iolib" "iquo" "irem" - "is_gmp" "isqrt" "`kernel/transpose`" "lcoeff" "ldegree" "length" - "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" - "member" "min" "minus" "mod" "modp" "modp1" "modp2" "mods" - "mul" "mvMultiply" "negate" "nops" "normal" "not" "numboccur" - "numer" "op" "or" "order" "ormap" "parse" "piecewise" - "pointto" "print" "quit" "readlib" "reduce_opr" "remove" - "rhs" "rtable" "rtableInfo" "rtable_eval" "rtable_indfns" - "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" - "rtable_num_elems" "rtable_options" "rtable_scanblock" - "rtable_sort_indices" "rtable_zip" "searchtext" "select" - "selectremove" "seq" "series" "setattribute" "sign" "sort" - "ssystem" "stop" "streamcall" "subs" "subset" "subsop" - "substring" "system" "table" "taylor" "tcoeff" "time" - "timelimit" "traperror" "trunc" "type" "typematch" - "unames" "unbind" "union" "userinfo" "writeto" "xor" "`||`")) - (10 . ("`$`" "`*`" "`**`" "`+`" "`..`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`?()`" "`?[]`" - "ASSERT" "Array" "ArrayOptions" "CopySign" - "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" - "ERROR" "EqualEntries" "EqualStructure" "FromInert" - "Im" "MPFloat" "MorrBrilCull" "NextAfter" "Normalizer" - "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" - "OrderedNE" "RETURN" "Re" "SDMPolynom" "SFloatExponent" "SFloatMantissa" - "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" - "Unordered" "UpdateSource" "`[]`" "`^`" - "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" - "abs" "add" "addressof" "alias" "anames" "and" "andmap" - "appendto" "array" "assemble" "assigned" "attributes" - "bind" "call_external" "callback" "cat" "coeff" "coeffs" - "conjugate" "convert" "crinterp" "debugopts" "define_external" - "degree" "denom" "diff" "disassemble" "divide" - "dlclose" "done" "entries" "eval" "evalb" "evalf" - "evalf/hypergeom/kernel" "evalgf1" "evalhf" "evaln" "expand" - "exports" "factorial" "frem" "frontend" "gc" "genpoly" "gmp_isprime" - "goto" "has" "hastype" "hfarray" "icontent" "if" "igcd" "ilog10" - "ilog2" "implies" "indets" "indices" "inner" "int/series" - "intersect" "iolib" "iquo" "irem" "is_gmp" "isqrt" - "kernel/transpose" "kernelopts" "lcoeff" "ldegree" "length" - "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" - "member" "min" "minus" "mod" "modp" "modp1" "modp2" "mods" "mul" - "mvMultiply" "negate" "nops" "normal" "not" "numboccur" "numer" - "op" "or" "order" "ormap" "overload" "parse" "piecewise" "pointto" - "print" "quit" "readlib" "reduce_opr" "remove" "rhs" "rtable" - "rtableInfo" "rtable_convolution" "rtable_eval" "rtable_histogram" - "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" - "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_redim" - "rtable_scale" "rtable_scanblock" "rtable_sort_indices" "rtable_zip" - "savelib" "searchtext" "select" "selectremove" "seq" "series" - "setattribute" "sign" "sort" "ssystem" "stop" "streamcall" "subs" - "subset" "subsop" "substring" "system" "table" "taylor" "tcoeff" - "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" - "unbind" "union" "userinfo" "writeto" "xor" "`{}`" "`||`")) - (11 . ("`$`" "`*`" "`**`" "`+`" "`..`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`?()`" "`?[]`" - "ASSERT" "Array" "ArrayOptions" "CopySign" - "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" - "ERROR" "EqualEntries" "EqualStructure" "FromInert" - "Im" "MPFloat" "MorrBrilCull" "NextAfter" "Normalizer" - "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" - "OrderedNE" "RETURN" "Re" "SDMPolynom" "SFloatExponent" "SFloatMantissa" - "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" - "Unordered" "UpdateSource" "`[]`" "`^`" - "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" - "abs" "add" "addressof" "alias" "anames" "and" "andmap" - "appendto" "array" "assemble" "assigned" "attributes" - "bind" "call_external" "callback" "cat" "coeff" "coeffs" - "conjugate" "convert" "crinterp" "debugopts" "define_external" - "degree" "denom" "diff" "disassemble" "divide" - "dlclose" "done" "entries" "eval" "evalb" "evalf" - "evalf/hypergeom/kernel" "evalgf1" "evalhf" "evaln" "expand" - "exports" "factorial" "frem" "frontend" "gc" "genpoly" "gmp_isprime" - "goto" "has" "hastype" "hfarray" "icontent" "if" "igcd" "ilog10" - "ilog2" "implies" "indets" "indices" "inner" "int/series" - "intersect" "iolib" "iquo" "irem" "is_gmp" "isqrt" - "kernel/transpose" "kernelopts" "lcoeff" "ldegree" "length" - "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" - "member" "min" "minus" "mod" "modp" "modp1" "modp2" "mods" "mul" - "mvMultiply" "negate" "nops" "normal" "not" "numboccur" "numer" - "op" "or" "order" "ormap" "overload" "parse" "piecewise" "pointto" - "print" "quit" "readlib" "reduce_opr" "remove" "rhs" "rtable" - "rtableInfo" "rtable_convolution" "rtable_eval" "rtable_histogram" - "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" - "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_redim" - "rtable_scale" "rtable_scanblock" "rtable_sort_indices" "rtable_zip" - "savelib" "searchtext" "select" "selectremove" "seq" "series" - "setattribute" "sign" "sort" "ssystem" "stop" "streamcall" "subs" - "subset" "subsop" "substring" "system" "table" "taylor" "tcoeff" - "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" - "unbind" "union" "userinfo" "writeto" "xor" "`{}`" "`||`")) - "Alist of Maple builtin funtions. The key is the major release.")) + `((3 . ,maplev--builtin-functions-3) + (4 . ,maplev--builtin-functions-4) + (5 . ,maplev--builtin-functions-5) + (6 . ,maplev--builtin-functions-6) + (7 . ,maplev--builtin-functions-7) + (8 . ,maplev--builtin-functions-8) + (9 . ,maplev--builtin-functions-9) + (10 . ,maplev--builtin-functions-10) + (11 . ,maplev--builtin-functions-11) + (12 . ,maplev--builtin-functions-12) + (13 . ,maplev--builtin-functions-13) + (14 . ,maplev--builtin-functions-14) + (15 . ,maplev--builtin-functions-15) + (16 . ,maplev--builtin-functions-16) + "Alist of Maple builtin funtions. The key is the major release.")) + +;; (defconst maplev--builtin-functions-alist +;; '((3 . ("`$`" "ERROR" "Im" "RETURN" "Re" "SearchText" "abs" "addressof" "alias" "anames" "appendto" "array" "assemble" "assigned" "callback" "cat" "coeff" "coeffs" "convert" "debugopts" "degree" "diff" "disassemble" "divide" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom`" "evalhf" "evaln" "expand" "frontend" "gc" "genpoly" "goto" "has" "hastype" "icontent" "`if`" "igcd" "ilog10" "indets" "indices" "intersect" "`int/series`" "iquo" "irem" "isqrt" "lcoeff" "ldegree" "length" "lexorder" "lprint" "macro" "map" "max" "maxnorm" "member" "min" "`minus`" "modp" "modp1" "mods" "nops" "normal" "numboccur" "numer" "op" "order" "parse" "pointto" "print" "printf" "protect" "readlib" "readline" "searchtext" "select" "seq" "series" "sign" "sort" "sscanf" "ssystem" "subs" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "traperror" "trunc" "type" "unames" "`union`" "unprotect" "userinfo" "words" "writeto" )) +;; (4 . ("`$`" "`*`" "`+`" "ASSERT" "DEBUG" "ERROR" "Im" "MorrBrilCull" "RETURN" "Re" "SearchText" "abs" "add" "addressof" "alias" "anames" "appendto" "array" "assemble" "assigned" "attributes" "callback" "cat" "coeff" "coeffs" "convert" "debugopts" "degree" "denom" "diff" "disassemble" "divide" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom`" "evalhf" "evaln" "expand" "frontend" "gc" "genpoly" "getuserinterface" "goto" "has" "hastype" "icontent" "`if`" "igcd" "ilog10" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "modp" "modp1" "mods" "mul" "nops" "normal" "numboccur" "numer" "op" "order" "parse" "pointto" "print" "readlib" "searchtext" "select" "seq" "series" "setattribute" "setuserinterface" "sign" "sort" "ssystem" "subs" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "traperror" "trunc" "type" "typematch" "unames" "`union`" "userinfo" "writeto" )) +;; (5 . ("`$`" "`*`" "`**`" "`+`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`^`" "ASSERT" "DEBUG" "ERROR" "Im" "MorrBrilCull" "RETURN" "Re" "SearchText" "abs" "add" "addressof" "alias" "anames" "appendto" "array" "assemble" "assigned" "attributes" "call" "callback" "cat" "coeff" "coeffs" "convert" "crinterp" "debugopts" "define" "degree" "denom" "diff" "disassemble" "divide" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalhf" "evaln" "expand" "frontend" "gc" "genpoly" "getuserinterface" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "modp" "modp1" "mods" "mul" "nops" "normal" "numboccur" "numer" "op" "order" "parse" "pointto" "print" "readlib" "searchtext" "select" "seq" "series" "setattribute" "setuserinterface" "sign" "sort" "ssystem" "subs" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "`union`" "userinfo" "writeto" )) +;; (6 . ("`$`" "`*`" "`**`" "`+`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`||`" "`^`" "ASSERT" "Array" "ArrayOptions" "CopySign" "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" "MPFloat" "MorrBrilCull" "NextAfter" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" "Unordered" "abs" "add" "addressof" "alias" "anames" "`and`" "appendto" "array" "assemble" "assigned" "attributes" "bind" "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" "divide" "`done`" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalgf1" "evalhf" "evaln" "expand" "exports" "frem" "frontend" "gc" "genpoly" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "ilog2" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" "negate" "nops" "normal" "`not`" "numboccur" "numer" "op" "`or`" "order" "parse" "pointto" "print" "`quit`" "readlib" "remove" "rhs" "rtable" "rtableInfo" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_scanblock" "rtable_sort_indices" "searchtext" "select" "selectremove" "seq" "series" "setattribute" "sign" "sort" "ssystem" "`stop`" "streamcall" "subs" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "unbind" "`union`" "userinfo" "writeto" )) +;; (7 . ("`$`" "`*`" "`**`" "`+`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`||`" "`^`" "ASSERT" "Array" "ArrayOptions" "CopySign" "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" "MPFloat" "MorrBrilCull" "NextAfter" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" "Unordered" "_treeMatch" "_unify" "_xml" "abs" "add" "addressof" "alias" "anames" "`and`" "appendto" "array" "assemble" "assigned" "attributes" "bind" "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" "divide" "dlclose" "`done`" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalgf1" "evalhf" "evaln" "expand" "exports" "factorial" "frem" "frontend" "gc" "genpoly" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "ilog2" "'implies'" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" "negate" "nops" "normal" "`not`" "numboccur" "numer" "op" "`or`" "order" "parse" "pointto" "print" "`quit`" "readlib" "remove" "rhs" "rtable" "rtableInfo" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_scanblock" "rtable_sort_indices" "searchtext" "select" "selectremove" "seq" "series" "setattribute" "sign" "sort" "ssystem" "`stop`" "streamcall" "subs" "`subset`" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "unbind" "`union`" "userinfo" "writeto" "`xor`" )) +;; (8 . ("`$`" "`*`" "`**`" "`+`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`||`" "`^`" "ASSERT" "Array" "ArrayOptions" "CopySign" "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" "MPFloat" "MorrBrilCull" "NextAfter" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" "Unordered" "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" "abs" "add" "addressof" "alias" "anames" "`and`" "andmap" "appendto" "array" "assemble" "assigned" "attributes" "bind" "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" "divide" "dlclose" "`done`" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalgf1" "evalhf" "evaln" "expand" "exports" "factorial" "frem" "frontend" "gc" "genpoly" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "ilog2" "'implies'" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" "negate" "nops" "normal" "`not`" "numboccur" "numer" "op" "`or`" "order" "ormap" "parse" "pointto" "print" "`quit`" "readlib" "remove" "rhs" "rtable" "rtableInfo" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_scanblock" "rtable_sort_indices" "searchtext" "select" "selectremove" "seq" "series" "setattribute" "sign" "sort" "ssystem" "`stop`" "streamcall" "subs" "`subset`" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "unbind" "`union`" "userinfo" "writeto" "`xor`" )) +;; (9 . ("`$`" "`*`" "`**`" "`+`" "`..`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`||`" "`^`" "ASSERT" "Array" "ArrayOptions" "CopySign" "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" "MPFloat" "MorrBrilCull" "NextAfter" "Normalizer" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" "Unordered" "UpdateSource" "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" "abs" "add" "addressof" "alias" "anames" "`and`" "andmap" "appendto" "array" "assemble" "assigned" "attributes" "bind" "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" "divide" "dlclose" "`done`" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalgf1" "evalhf" "evaln" "expand" "exports" "factorial" "frem" "frontend" "gc" "genpoly" "gmp_isprime" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "ilog2" "'implies'" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "is_gmp" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "`mod`" "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" "negate" "nops" "normal" "`not`" "numboccur" "numer" "op" "`or`" "order" "ormap" "parse" "piecewise" "pointto" "print" "`quit`" "readlib" "reduce_opr" "remove" "rhs" "rtable" "rtableInfo" "rtable_eval" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_scanblock" "rtable_sort_indices" "rtable_zip" "searchtext" "select" "selectremove" "seq" "series" "setattribute" "sign" "sort" "ssystem" "`stop`" "streamcall" "subs" "`subset`" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "unbind" "`union`" "userinfo" "writeto" "`xor`" )) +;; (10 . ("`$`" "`*`" "`**`" "`+`" "`..`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`?()`" "`?[]`" "`{}`" "`||`" "`[]`" "`^`" "ASSERT" "Array" "ArrayOptions" "CopySign" "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" "MPFloat" "MorrBrilCull" "NextAfter" "Normalizer" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" "SDMPolynom" "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" "Unordered" "UpdateSource" "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" "abs" "add" "addressof" "alias" "anames" "`and`" "andmap" "appendto" "array" "assemble" "assigned" "attributes" "bind" "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" "divide" "dlclose" "`done`" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalgf1" "evalhf" "evaln" "expand" "exports" "factorial" "frem" "frontend" "gc" "genpoly" "gmp_isprime" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "ilog2" "'implies'" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "is_gmp" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "`mod`" "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" "negate" "nops" "normal" "`not`" "numboccur" "numer" "op" "`or`" "order" "ormap" "overload" "parse" "piecewise" "pointto" "print" "`quit`" "readlib" "reduce_opr" "remove" "rhs" "rtable" "rtableInfo" "rtable_convolution" "rtable_eval" "rtable_histogram" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_redim" "rtable_scale" "rtable_scanblock" "rtable_sort_indices" "rtable_zip" "savelib" "searchtext" "select" "selectremove" "seq" "series" "setattribute" "sign" "sort" "ssystem" "`stop`" "streamcall" "subs" "`subset`" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "unbind" "`union`" "userinfo" "writeto" "`xor`" )) +;; (11 . ("`$`" "`*`" "`**`" "`+`" "`..`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`?()`" "`?[]`" "`{}`" "`||`" "`[]`" "`^`" "ASSERT" "Array" "ArrayOptions" "CopySign" "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" "MPFloat" "MorrBrilCull" "NextAfter" "Normalizer" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" "SDMPolynom" "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" "Unordered" "UpdateSource" "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" "abs" "add" "addressof" "alias" "anames" "`and`" "andmap" "appendto" "array" "assemble" "assigned" "attributes" "bind" "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" "divide" "dlclose" "`done`" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalgf1" "evalhf" "evaln" "expand" "exports" "factorial" "frem" "frontend" "gc" "genpoly" "gmp_isprime" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "ilog2" "'implies'" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "is_gmp" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "`mod`" "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" "negate" "nops" "normal" "`not`" "numboccur" "numer" "op" "`or`" "order" "ormap" "overload" "parse" "piecewise" "pointto" "print" "`quit`" "readlib" "reduce_opr" "remove" "rhs" "rtable" "rtableInfo" "rtable_convolution" "rtable_eval" "rtable_histogram" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_redim" "rtable_scale" "rtable_scanblock" "rtable_sort_indices" "rtable_zip" "savelib" "searchtext" "select" "selectremove" "seq" "series" "setattribute" "sign" "sort" "ssystem" "`stop`" "streamcall" "subs" "`subset`" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "unbind" "`union`" "userinfo" "writeto" "`xor`" )) +;; (12 . ("`$`" "`*`" "`**`" "`+`" "`..`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`?()`" "`?[]`" "`{}`" "`||`" "`[]`" "`^`" "ASSERT" "Array" "ArrayOptions" "CopySign" "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" "MPFloat" "MorrBrilCull" "NextAfter" "Normalizer" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" "Record" "SDMPolynom" "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" "Unordered" "UpdateSource" "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" "abs" "add" "addressof" "alias" "anames" "`and`" "andmap" "appendto" "array" "assemble" "assigned" "attributes" "bind" "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" "divide" "dlclose" "`done`" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalgf1" "evalhf" "evaln" "expand" "exports" "factorial" "frem" "frontend" "gc" "genpoly" "gmp_isprime" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "ilog2" "'implies'" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "is_gmp" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "`mod`" "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" "negate" "nops" "normal" "`not`" "numboccur" "numer" "op" "`or`" "order" "ormap" "overload" "parse" "piecewise" "pointto" "print" "`quit`" "readlib" "reduce_opr" "remove" "rhs" "rtable" "rtableInfo" "rtable_convolution" "rtable_eval" "rtable_histogram" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_redim" "rtable_scale" "rtable_scanblock" "rtable_size" "rtable_sort_indices" "rtable_zip" "savelib" "searchtext" "select" "selectremove" "seq" "series" "setattribute" "sign" "sort" "ssystem" "`stop`" "streamcall" "subs" "`subset`" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "unbind" "`union`" "userinfo" "writeto" "`xor`" )) +;; (13 . ("`$`" "`*`" "`**`" "`+`" "`..`" "`::`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`?()`" "`?[]`" "`{}`" "`||`" "`~`" "`[]`" "`^`" "ASSERT" "Array" "ArrayOptions" "CopySign" "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" "MPFloat" "MorrBrilCull" "NextAfter" "Normalizer" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "OrderedNE" "RETURN" "Re" "Record" "SDMPolynom" "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" "Unordered" "UpdateSource" "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" "abs" "add" "addressof" "alias" "anames" "`and`" "andmap" "appendto" "array" "assemble" "assigned" "attributes" "bind" "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" "divide" "dlclose" "`done`" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalgf1" "evalhf" "evaln" "expand" "exports" "factorial" "frem" "frontend" "gc" "genpoly" "gmp_isprime" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "ilog2" "`implies`" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "is_gmp" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "`mod`" "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" "negate" "nops" "normal" "`not`" "numboccur" "numer" "op" "`or`" "order" "ormap" "overload" "parse" "piecewise" "pointto" "print" "`quit`" "readlib" "reduce_opr" "remove" "rhs" "rtable" "rtableInfo" "rtable_convolution" "rtable_eval" "rtable_histogram" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_redim" "rtable_scale" "rtable_scanblock" "rtable_size" "rtable_sort_indices" "rtable_zip" "savelib" "searchtext" "select" "selectremove" "seq" "series" "setattribute" "sign" "sort" "ssystem" "`stop`" "streamcall" "subs" "`subset`" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "unbind" "`union`" "userinfo" "writeto" "`xor`" )) +;; (14 . ("`$`" "`*`" "`**`" "`+`" "`..`" "`::`" "`<`" "`<=`" "`<>`" "`=`" "`>`" "`>=`" "`?()`" "`?[]`" "`{}`" "`||`" "`~`" "`[]`" "`^`" "ASSERT" "Array" "ArrayOptions" "CopySign" "DEBUG" "Default0" "DefaultOverflow" "DefaultUnderflow" "ERROR" "EqualEntries" "EqualStructure" "FromInert" "Im" "MPFloat" "MorrBrilCull" "NextAfter" "Normalizer" "NumericClass" "NumericEvent" "NumericEventHandler" "NumericStatus" "Object" "OrderedNE" "RETURN" "Re" "Record" "SDMPolynom" "SFloatExponent" "SFloatMantissa" "Scale10" "Scale2" "SearchText" "TRACE" "ToInert" "Unordered" "UpdateSource" "_jvm" "_maplet" "_treeMatch" "_unify" "_xml" "abs" "add" "addressof" "alias" "anames" "`and`" "andmap" "appendto" "array" "assemble" "assigned" "attributes" "bind" "call_external" "callback" "cat" "coeff" "coeffs" "conjugate" "convert" "crinterp" "debugopts" "define_external" "degree" "denom" "diff" "disassemble" "divide" "dlclose" "`done`" "entries" "eval" "evalb" "evalf" "`evalf/hypergeom/kernel`" "evalgf1" "evalhf" "evaln" "expand" "exports" "factorial" "frem" "frontend" "gc" "genpoly" "gmp_isprime" "goto" "has" "hastype" "hfarray" "icontent" "`if`" "igcd" "ilog10" "ilog2" "`implies`" "indets" "indices" "inner" "intersect" "`int/series`" "iolib" "iquo" "irem" "is_gmp" "isqrt" "kernelopts" "`kernel/transpose`" "lcoeff" "ldegree" "length" "lexorder" "lhs" "lprint" "macro" "map" "map2" "max" "maxnorm" "member" "min" "`minus`" "`mod`" "modp" "modp1" "modp2" "mods" "mul" "mvMultiply" "negate" "nops" "normal" "`not`" "numboccur" "numer" "op" "`or`" "order" "ormap" "overload" "parse" "piecewise" "pointto" "print" "`quit`" "readlib" "reduce_opr" "remove" "rhs" "rtable" "rtableInfo" "rtable_convolution" "rtable_eval" "rtable_histogram" "rtable_indfns" "rtable_is_zero" "rtable_normalize_index" "rtable_num_dims" "rtable_num_elems" "rtable_options" "rtable_redim" "rtable_scale" "rtable_scanblock" "rtable_size" "rtable_sort_indices" "rtable_zip" "savelib" "searchtext" "select" "selectremove" "seq" "series" "setattribute" "sign" "sort" "ssystem" "`stop`" "streamcall" "subs" "`subset`" "subsop" "substring" "system" "table" "taylor" "tcoeff" "time" "timelimit" "traperror" "trunc" "type" "typematch" "unames" "unbind" "`union`" "userinfo" "writeto" "`xor`" )) +;; "Alist of Maple builtin funtions. The key is the major release.")) + +;;}}} (defun maplev--ditto-operators-re () "Return a regexp that matches the ditto operators." @@ -3015,6 +3273,73 @@ '("\"" "\"\"" "\"\"\"") '("%" "%%" "%%%")))) +(defvar maplev-protected-face 'maplev-protected-face + "*Face name for Maple protected names.") + +(defface maplev-protected-face + '((((class grayscale) (background light)) (:foreground "LightGray" :bold t)) + (((class grayscale) (background dark)) (:foreground "DimGray" :bold t)) + (((class color) (background light)) (:foreground "LImeGreen")) + (((class color) (background dark)) (:foreground "LimeGreen")) + (t (:bold t))) + "Font lock mode face used for Maple protected names." + :group 'maplev-faces) + +(defconst maplev--protected-names-re + (eval-when-compile + (concat "\\<\\(?:" + (regexp-opt + (list "ARRAY" "Add" "And" "Cache" "Catalan" "Complex" "D" "DESol" "Ei" "Eval" "Expand" + "FAIL" "Float" "Fraction" "HFloat" "Implies" "ImportData" "Int" "Integer" + "JacobiAM" "JacobiCN" "JacobiCS" "JacobiNC" "JacobiNS" "JacobiSC" "JacobiSN" + "LinearAlgebra" "ListTools" "Matlab" "Matrix" "Multiply" + "Non" "Normal" "Not" "NumericTools" "O" "Or" "Pi" "Plot" "Power" "Product" "RealRange" + "SFloat" "Shift" "Sum" "SymbolicInfinity" "TABLE" "TEXT" + "Vector" "VectorOptions" "WARNING" "Xor" + "algebraic" "algext" "algfun" "algnum" "algnumext" + "ansi" "anyfunc" "anything" "apply" "atomic" + "boolean" "bytesused" + "charfcn" "collect" "combine" "complex" "complexcons" "constant" "copy" "cubic" "curry" "cx_infinity" "cx_zero" + "dagtag" "deduced" "division_by_zero" + "echo" "embedded_axis" "embedded_imaginary" "embedded_real" "equation" "errorbreak" "errorcursor" + "evala" "evalr" "even" "evenfunc" "expanded" "extended_numeric" "extended_rational" + "facint" "false" "fflush" "finite" "float" "fprintf" "frac" "fraction" "freeze" "function" + "gamma" "gcfreq" "hasassumptions" "hasfun" "hfloat" + "identical" "imaginary" "`in`" "indentamount" "interface" "index" "indexable" "indexed" "inexact" + "infinity" "integer" "invalid_operation" "invfunc" "iperfpow" "iroot" "is" + "labelling" "laurent" "leadterm" "linear" "list" "listlist" "literal" + "mathfunc" "matrix" "`module`" "moduledefinition" "monomial" + "name" "negative" "neg_infinity" "negint" "negzero" "nonnegative" + "nonnegint" "nonposint" "nonpositive" "nonreal" "norm" "nothing" "numeric" + "odd" "oddfunc" "overflow" + "package" "plotdevice" "plotoptions" "plotoutput" "point" "polynom" "pos_infinity" "posint" "positive" + "postplot" "poszero" "preplot" "prettyprint" "prime" "primpart" "printbytes" "procedure" "prompt" "proot" "protected" "psqrt" + "quadratic" "quartic" "quiet" + "radext" "radfun" "radfunext" "radical" "radnormal" "radnum" "radnumext" "range" "rational" + "ratpoly" "rcurry" "real" "realcons" "real_infinity" "real_to_complex" "relation" "restart" "resultant" "round" + "scalar" "screenheight" "screenwidth" "sequential" "set" "sfloat" "shake" + "showassumed" "simplify" "specfunc" "sqrt" "stack" "string" "subtype" "symbol" "symmfunc" + "tabular" "testeq" "thaw" "tracelast" "trig" "true" "truefalse" + "unapply" "undefined" "underflow" "uneval" "usage" + "vector" "verboseproc" "verify" "warnlevel" "with" "wordsize" "zppoly" + + "exp" "ln" "log" "log10" + "sin" "cos" "tan" + "sec" "csc" "cot" + "sinh" "cosh" "tanh" + "sech" "csch" "coth" + + "arcsin" "arccos" "arctan" + "arcsec" "arccsc" "arccot" + "arcsinh" "arccosh" "arctanh" + "arcsech" "arccsch" "arccoth" + )) + "\\)\\>"))) + + +(defconst maplev--protected-names-procs-re + (list "evalindets" "subsindets")) + (defun maplev-font-lock-keywords-1 () "Compute the minimum decoration `font-lock-keywords' for MapleV mode. Top level procedures, Maple reserved words, and preprocessor directives @@ -3048,7 +3373,10 @@ (cdr (assoc (maplev--major-release) maplev--builtin-functions-alist))) ;; Xemacs doesn't have font-lock-builtin-face - '(0 font-lock-variable-name-face)))))) + '(0 font-lock-variable-name-face)) + (list maplev--deprecated-re '(0 font-lock-warning-face)) + (list maplev--protected-names-re '(0 maplev-protected-face)))))) + (defun maplev--font-lock-keywords () "Return a list of symbols for font locking MapleV mode buffers." '(maplev-font-lock-keywords-3 ; default is maximum decoration @@ -3119,6 +3447,150 @@ ;;}}} +;;{{{ Includes + +(defface maplev-find-include-file + '((((class grayscale) (background light)) (:foreground "LightGray" :underline t)) + (((class grayscale) (background dark)) (:foreground "DarkGray" :underline t)) + (((class color) (background light)) (:foreground "DarkBlue" :underline t)) + (((class color) (background dark)) (:foreground "LightBlue" :underline t)) + (t (:underline t))) + "Font lock face used for include filenames, indicates hyperlink." + :group 'maplev-faces) + +(defun maplev-buttonize-includes () + "Buttonize the include statements." + (button-lock-mode t) + (button-lock-set-button maplev--include-directive-re + 'maplev-find-include-file-at-point + :face 'link + :face-policy 'prepend + :grouping 2 + :keyboard-binding "C-c C-o" + :help-text "open file")) + +(defun maplev-find-include-file-at-point (toggle) + "Open the include file at point. If found, the file is opened +either in this window or the other window, depending on the +exclusive-or of TOGGLE with `maplev-include-file-other-window-flag'. +The variable `maplev-include-path' specifies the search paths; +it is a list of rooted strings. If the file cannot be found, but +the proper directory exists, query user to create the file." + (interactive "P") + (save-excursion + (beginning-of-line) + (unless (looking-at maplev--include-directive-re) + (error "Not at an include statement")) + (let* ((inc-file (match-string-no-properties 2)) + (path maplev-include-path) + (inc-first (string= "<" (match-string-no-properties 1))) + file) + (setq file (maplev-find-include-file inc-file inc-first path)) + (if file + (find-file-other-window file) + ;; file does not exist. If suitable location can be found from include path, + ;; query to create + (let ((base (file-name-nondirectory inc-file)) + (inc-dir inc-file)) + (while (and (setq inc-dir (file-name-directory (directory-file-name inc-dir))) + (not (setq file (maplev-find-include-file inc-dir inc-first path))))) + (if (not file) + (error "Include file %s does not exist " inc-file) + (if (yes-or-no-p (format "Create include file %s " + (setq file (concat file base)))) + (if (if maplev-include-file-other-window-flag + (not toggle) + toggle) + (find-file-other-window file) + (find-file file))))))))) + +(defun maplev-find-include-file (inc-file &optional inc-first inc-path) + "Find the Maple include file INC-FILE and return as an absolute path. +INC-PATH is an optional list of rooted directories. Use each +directory, in order, as parent of INC-FILE. If INC-FIRST is +non-nil, search the INC-PATH directories before using the +`default-directory'. If those searches fail, search each parent +of `default-directory'. Return nil if the file is not found." + (if (file-name-absolute-p inc-file) + (and (file-exists-p inc-file) inc-file) + (if inc-first + (or + (maplev-include--find-file-in-path inc-file inc-path) + (maplev-include--find-file-up-path inc-file)) + (or (maplev-include--find-file-in-path inc-file (list default-directory)) + (maplev-include--find-file-in-path inc-file inc-path) + (maplev-include--find-file-up-path inc-file))))) + +(defun maplev-include--find-file-in-path (file &optional paths) + "Search for FILE in a list of rooted PATHS, which include trailing slash. +If found, return the absolute path to FILE, otherwise return nil." + (let (dir abs-file) + (while (not (progn + (setq dir (car paths) + paths (cdr paths) + abs-file (concat dir file)) + (or (file-exists-p abs-file) + (setq abs-file nil) + (null paths))))) + (and abs-file + (expand-file-name abs-file)))) + +(defun maplev-include--find-file-up-path (file &optional dir) + "Find FILE, optionally searching in directory DIR. +Look in each ancestor in DIR. If DIR is nil, use `default-directory'. +Return the absolute path to the file, if found, otherwise return +nil." + (setq dir (file-name-as-directory (or dir default-directory))) + (let (parent abs-file) + (while + (if (file-exists-p (setq abs-file (concat dir file))) + nil ; success; exit loop + (if (or (null (setq parent (file-name-directory (directory-file-name dir)))) + (string= dir parent)) + (setq abs-file nil) ; at root, exit loop with empty file + (setq dir parent)))) ; check parent + abs-file)) + +(define-button-type 'maplev-find-include-file + 'help-echo "Find include file" + 'action 'maplev-find-include-file-at-point + 'follow-link t + 'face 'maplev-include-file) + +;;}}} + +;;{{{ Config file (.maplev) + +(defun maplev-load-config-file (&optional force) + "Find and load the maplev configuration file. +The file is named .maplev and is searched for in the current +directory and its ancestors. Return t if configuration file was +loaded, nil otherwise." + (let ((config (maplev-include--find-file-up-path ".maplev"))) + (when config + (condition-case err + (load-file config) + (error + (message "An error occurred loading config file %s" config)))))) + +;;}}} + +;;{{{ leading-comma stuff + +(defadvice fixup-whitespace (after maplev-fixup-whitespace) + "Catenate adjacent Maple strings (separated by one space) or, +if `maplev-leading-comma-flag' is non-nil, remove space before a comma." + (if (and maplev-leading-comma-flag + (looking-at " ,")) + (delete-char 1) + (when (and (looking-at " \"") + (looking-back "\"")) + (delete-char -1) + (delete-char 2)))) + + +;;}}} + ;;; Process Modes ;;{{{ Group definitions @@ -3142,18 +3614,18 @@ ;;{{{ buffers (defcustom maplev-pop-up-frames-flag nil - "*Non-nil means help pages and procedure listings start in a separate frame." + "Non-nil means help pages and procedure listings start in a separate frame." :type 'boolean :group 'maplev-misc) (defcustom maplev-cmaple-end-notice "END_OF_OUTPUT" - "*Message used to indicate the end of Maple output." + "Message used to indicate the end of Maple output." :type 'string :group 'maplev-misc) (defcustom maplev-cmaple-echoes-flag (not (string-match "windows-nt\\|ms-dos" (symbol-name system-type))) - "*Non-nil means the process echoes." + "Non-nil means the process echoes." :type 'boolean :group 'maplev-buffer :group 'maplev-important) @@ -3161,7 +3633,7 @@ ;;}}} ;;{{{ maple setup (defcustom maplev-start-options (list "-q") - "*List of Maple command line options. Each item is a string." + "List of Maple command line options. Each item is a string." :type 'list :group 'maplev-executables) @@ -3194,15 +3666,16 @@ (defun maplev--help-buffer () "Return the name of the Maple help buffer." - (concat "Maple R" maplev-release " help")) + (format "Maple %s help" maplev-release)) (defun maplev--proc-buffer () "Return the name of the Maple procedure listing buffer." - (concat "Maple R" maplev-release " proc")) + (format "Maple %s proc" maplev-release)) (defun maplev--cmaple-buffer () "Return the name of the Maple cmaple buffer." - (concat "Maple R" maplev-release)) + (format "Maple %s" maplev-release)) + ;;}}} ;;{{{ Maple @@ -3245,6 +3718,14 @@ process (maplev-cmaple--start-process)))) +(defun maplev--cmaple-get-init-string (release) + "Return the initialization string passed to the Maple process. +If RELEASE is an index in `maplev-init-string-alist' then use the entry, +otherwise use `maplev-default-init-string'." + (let ((init (assoc release maplev-init-string-alist))) + (if init + (cdr init) + maplev-default-init-string))) (defun maplev-cmaple--start-process () "Start a cmaple process associated with the current buffer. @@ -3255,36 +3736,36 @@ (inifile (nth 1 (cdr (assoc release maplev-executable-alist)))) (buffer (get-buffer-create (maplev--cmaple-buffer))) (process (get-buffer-process buffer)) + (include-path maplev-include-path) ;; Just testing this. Is there an advantage to a PTY process? (process-connection-type 'pty)) (with-current-buffer buffer - (message "Starting Maple R%s..." release) + (message "Starting Maple %s..." release) (if process (delete-process process)) (if maplev-startup-directory (cd (expand-file-name maplev-startup-directory))) (set-process-filter ;; `apply' is used because `maplev-start-options' is a list. (setq process (apply 'start-process - (concat "Maple R" release) + (format "Maple %s" release) buffer cmaple (append (and inifile (list "-i" inifile)) maplev-start-options ;; add include path to argument list - (and maplev-include-path + (and include-path (list (concat "-I " - (mapconcat 'identity maplev-include-path ","))))))) + (mapconcat 'identity include-path ","))))))) 'maplev--cmaple-filter) (maplev-cmaple-mode release) (maplev-cmaple--lock-access t) - (comint-simple-send process - (cdr (assoc release maplev-init-string-alist))) + (comint-simple-send process (maplev--cmaple-get-init-string release)) (maplev-cmaple--send-end-notice process) ;; Wait until cmaple is unlocked, that is, it has responded. ;; The time step, 100 milliseconds, should be customizable, some OSs ;; do not support fractions of seconds. ;; (while (maplev-cmaple--locked-p) (maplev--short-delay)) (maplev-cmaple--wait) - (message "Maple R%s started" release) + (message "Maple %s started" release) process))) ;; Access control @@ -3328,7 +3809,7 @@ ;;hieida: ;; (let ((status (get 'maplev-cmaple-state maplev-release))) (let ((status (get 'maplev-cmaple-state 'maplev-release))) - (message "Maple R%s %s" maplev-release + (message "Maple %s %s" maplev-release (cond ((eq status 'locked) "locked") ((not status) "unlocked") (status))))) @@ -3337,19 +3818,18 @@ "Wait for cmaple to become available. If optional argument MAX-CNT is non-nil, wait at most that many seconds; otherwise wait indefinitly. If optional argument NO-ERR is -nil, generate an error if time out occurs; if non-nil, do not generate -an error." - (message "Maple busy, waiting...") - (let ((cnt (* 10 (or max-cnt 0)))) - (while (and (maplev-cmaple--locked-p) - (or (null max-cnt) - (< 0 (setq cnt (1- cnt))))) - ;; Should sit-for be used instead? It permits interrupting - ;; via user input (keystrokes). - (sleep-for 0.1)) - (and (not no-err) - (maplev-cmaple--locked-p) - (error "Maple busy.")))) +non-nil do not generate an error if time-out occurs." + (with-temp-message "Maple busy, waiting..." + (let ((cnt (* 10 (or max-cnt 0)))) + (while (and (maplev-cmaple--locked-p) + (or (null max-cnt) + (< 0 (setq cnt (1- cnt))))) + ;; Should sit-for be used instead? It permits interrupting + ;; via user input (keystrokes). + (sleep-for 0.1)) + (and (not no-err) + (maplev-cmaple--locked-p) + (error "Maple busy"))))) ;; Functions that send stuff to cmaple @@ -3369,12 +3849,11 @@ (defun maplev-cmaple--send-string (process string) "Send STRING to the cmaple process PROCESS." - ;; handle Maple `restart' by adding the initialization according to - ;; maplev-init-string-alist + ;; handle Maple `restart' by adding the initialization. (let ((str "") case-fold-search) (while (string-match "\\ (length string) (match-end 0)) (substring string (match-end 0)) ""))) @@ -3441,7 +3920,7 @@ (comint-simple-send process (concat "lprint(" maplev-cmaple-end-notice ");"))) (defun maplev-cmaple--ready (process) - "Return t if PROCESS \(cmaple\) ready for new input, nil otherwise. + "Return t if PROCESS \(cmaple\) is ready for new input, nil otherwise. Remove `maplev-cmaple-end-notice' from the current buffer. Reset the filter for PROCESS \(cmaple\) and unlock access." (let (case-fold-search) @@ -3476,8 +3955,7 @@ (defun maplev-cmaple--clear-buffer () "Clear the contents of the cmaple buffer." - (save-excursion - (set-buffer (maplev--cmaple-buffer)) + (with-current-buffer (maplev--cmaple-buffer) (delete-region (point-min) (point-max)))) @@ -3575,10 +4053,14 @@ (comint-mode) (setq comint-prompt-regexp (concat "^\\(" maplev-cmaple-prompt "\\)+ *") ;; GNU Emacs 21 - comint-use-prompt-regexp-instead-of-fields t comint-eol-on-send t major-mode 'maplev-cmaple-mode mode-name "Maple") + (if (< emacs-major-version 22) + ;; This generates a compiler warning. Ignore. + (with-no-warnings + (setq comint-use-prompt-regexp-instead-of-fields t)) + (setq comint-use-prompt-regexp t)) ;; Mint support (make-local-variable 'maplev-mint--code-beginning) @@ -3624,6 +4106,7 @@ (define-key map [(control c) (control s) ?h] 'maplev-switch-buffer-help) (define-key map [(control c) (control s) ?l] 'maplev-switch-buffer-proc) (define-key map [(control c) (control s) ?c] 'maplev-switch-buffer-cmaple) + (define-key map [(control c) (control c)] 'maplev-help-reset-help) (define-key map [?h] 'maplev-switch-buffer-help) ; short-cut (define-key map [?l] 'maplev-switch-buffer-proc) ; short-cut (define-key map [?c] 'maplev-switch-buffer-cmaple) ; short-cut @@ -3674,7 +4157,7 @@ (kill-all-local-variables) (setq major-mode 'maplev-help-mode) ;; needed by maplev-set-release (maplev-set-release release) - (setq mode-name (concat "Maple-Help R" maplev-release)) + (setq mode-name (format "Maple-Help %s" maplev-release)) (use-local-map maplev-help-mode-map) (set (make-local-variable 'maplev--process-item) (function maplev--help-process)) @@ -3697,7 +4180,23 @@ (interactive "e") (set-buffer (window-buffer (event-window click))) (goto-char (event-point click)) - (maplev-help-show-topic (maplev--ident-around-point))) + (let ((topic (maplev--ident-around-point)) + (pkg (maplev-help--get-package))) + (if pkg + ;; This frequently works when the help index does not have a + ;; link to the particular help page; I understand that that is + ;; a deficiency only with the tty help for smaple. + (setq topic (format "%s,%s" pkg topic))) + (maplev-help-show-topic topic))) + +(defun maplev-help--get-package () + "Check whether the help page is a package overview. +If so, return the name of the package, otherwise return nil." + (save-excursion + (goto-char (point-min)) + (let ((case-fold-search nil)) + (and (looking-at "\\(?:Details\\|Overview\\) of the \\(\\w+\\) [Pp]ackage") + (match-string-no-properties 1))))) (defun maplev--ident-around-point (&optional default) "Return the identifier around the point as a string. @@ -3778,15 +4277,14 @@ (defun maplev--help-process (topic) "Display Maple help for TOPIC in `maplev--help-buffer'." (let ((process (maplev--cmaple-process))) - ;; TODO this doesn't quite work, it echos in the cmaple buffer -;; (maplev-cmaple-direct "interface('screenheight'='infinity'):") (maplev-cmaple--lock-access) (set-process-filter process 'maplev--help-filter) (set-buffer (maplev--help-buffer)) (setq mode-line-buffer-identification (format "%-12s" topic)) (let (buffer-read-only) (delete-region (point-min) (point-max))) - (comint-simple-send process (concat "?" topic)) +;; (comint-simple-send process (concat "?" topic)) + (comint-simple-send process (format "interface('screenheight=infinity'):\n?%s" topic)) (maplev-cmaple--send-end-notice process))) ;; ;; TODO this doesn't quite work, it echos in the cmaple buffer ;; (maplev-cmaple-direct (concat "interface('screenheight'=" @@ -3813,6 +4311,10 @@ (if maplev-cmaple-echoes-flag (save-excursion (goto-char (point-min)) + ;; remove the echoed 'interface(screenheight=...) and ?topic lines + (when (looking-at "interface") + (forward-line) + (delete-region (point-min) (point))) (if (re-search-forward "\\`\\?.+\n" nil t) (delete-region (match-beginning 0) (match-end 0))))) (maplev-help-fontify-node) @@ -3840,6 +4342,28 @@ (switch-to-buffer buf) (message "No buffer \"%s\"." buffer)))) +(defun maplev-help-to-source (code-only) + "Convert a help page to a Maple source file." + (interactive "P") + (let (buffer-read-only) + (goto-char (point-min)) + (while (not (eobp)) + (if (looking-at "> ") + (progn + (delete-char 2) + (forward-line)) + (if (not code-only) + (progn + (insert "# ") + (forward-line)) + (delete-region (point) (line-end-position)) + (delete-char 1)))))) + +(defun maplev-help-reset-help () + "Reset the settings that affect the display of help pages." + (interactive) + (maplev-cmaple-direct (maplev--cmaple-get-init-string maplev-release) 'delete)) + ;;}}} ;;{{{ history mechanism @@ -3917,19 +4441,9 @@ :group 'maplev-faces :group 'maplev-help) - ;;}}} ;;{{{ regular expressions -;; (defconst maplev--help-section-re -;; (concat "^[A-Z]" ; Must start with a capital. -;; "\\([^\n]*:\\|\\(" ; If it ends with a colon (and whitespace) it matches. -;; "\\([a-z]+ ?\\)?" ; If it consists of no more than three alphabetic words, -;; "\\([A-Za-z][a-z]* ?\\)?" ; possibly with capitals, then it matches. -;; "\\([A-Za-z][a-z]* ?\\)?\\)" -;; "\\)[ \t]*$") -;; "Regular expression for sections in a Maple help page.") - (defconst maplev--help-section-re (concat "^\\(Calling Sequences?" "\\|Parameters" @@ -3937,6 +4451,10 @@ "\\|Examples" "\\|See Also" "\\|References" + "\\|Returns" + "\\|Notes" + "\\|Options" + "\\|Algorithm" "\\|\\(?:List of \\([][a-zA-Z_]+ \\)?\\(Package\\|Subpackage\\|Module\\) Commands\\)" "\\):?") "Regular expression for sections in a Maple help page.") @@ -3992,11 +4510,6 @@ (put-text-property (match-beginning 0) (match-end 0) 'face 'maplev-help-subsection-face)) - ;; Highlight section titles - (goto-char (point-min)) - (while (re-search-forward maplev--help-section-re nil t) - (put-text-property (match-beginning 0) (match-end 0) - 'face 'maplev-help-section-face)) ;; Highlight functions in a package. This usually works. It ;; searches for `- The functions [arbitrary text] are:' and @@ -4016,6 +4529,13 @@ (put-text-property (match-beginning 0) (match-end 0) 'face 'maplev-input-face)) + ;; Highligt Maple comments + (goto-char (point-min)) + (while (re-search-forward "^# .*$" nil t) + (put-text-property (match-beginning 0) (match-end 0) + 'face 'font-lock-comment-face)) + + ;; Activate hyperlinks following "See Also". ;; Stop when encountering a blank line. @@ -4023,9 +4543,25 @@ (and (re-search-backward "^See Also:?" nil 'move) (maplev--activate-hyperlinks (match-end 0) - (progn - (re-search-forward "^[ \t\n]*$" nil 'move) - (point)))) + (point-max))) + + + ;; Highlight section titles + (goto-char (point-min)) + (while (re-search-forward maplev--help-section-re nil t) + (put-text-property (match-beginning 0) (match-end 0) + 'face 'maplev-help-section-face)) + + + ;; Activate hyperlinks in text. This is overly aggressive. + (goto-char (point-min)) + (re-search-forward "^Description" nil t) + (while (re-search-forward "(\\([][a-zA-Z,]+\\))" nil 'move) + (save-excursion + (beginning-of-line) + (unless (looking-at "> ") + (maplev--activate-hyperlink (match-beginning 1) (match-end 1))))) + ;; Activate hyperlinks following "Multiple matches:". (goto-char (point-min)) @@ -4037,8 +4573,9 @@ (while (re-search-forward maplev--help-definition-re nil 'move) (let ((beg (match-beginning 1)) (end (match-end 1))) - (put-text-property beg end 'mouse-face 'highlight) - (put-text-property beg end 'face maplev-help-function-face)))))) + ;;(put-text-property beg end 'mouse-face 'highlight) + ;;(put-text-property beg end 'face maplev-help-function-face)))))) + (maplev--activate-hyperlink beg end)))))) (defun maplev--activate-hyperlinks (beg end) "Font lock and activate Maple keywords in the region from BEG to END." @@ -4053,9 +4590,13 @@ ;; In particular, ignore the syntactic meaning of, e.g., `[', ;; `]', and `,'. Thus we can use current-word to pick up ;; these Maple keywords. - (put-text-property beg end 'syntax-table '(2 . nil)) - (put-text-property beg end 'mouse-face 'highlight) - (put-text-property beg end 'face maplev-help-function-face)))) + (maplev--activate-hyperlink beg end)))) + +(defun maplev--activate-hyperlink (beg end) + "Font lock and activate text in region from BEG to END." + (put-text-property beg end 'syntax-table '(2 . nil)) + (put-text-property beg end 'mouse-face 'highlight) + (put-text-property beg end 'face maplev-help-function-face)) ;;}}} @@ -4093,7 +4634,7 @@ (setq major-mode 'maplev-proc-mode) ;; needed by maplev-set-release (maplev-set-release release) - (setq mode-name (concat "Maple-Proc R" maplev-release)) + (setq mode-name (format "Maple-Proc %s" maplev-release)) (use-local-map maplev-proc-mode-map) (set (make-local-variable 'maplev--process-item) @@ -4162,7 +4703,7 @@ (goto-char (point-min)) ;;(insert proc " := ") ) - (comint-simple-send process (concat "maplev_print(" proc ");")) + (comint-simple-send process (concat "maplev_print(\"" proc "\");")) (maplev-cmaple--send-end-notice process))) (defun maplev-proc-filter (process string) @@ -4208,26 +4749,25 @@ ;;{{{ customizable variables (defcustom maplev-mint-coding-system 'undecided-dos - "*Coding system used by Mint. See `coding-system-for-read' for details." + "Coding system used by Mint. See `coding-system-for-read' for details." :type '(choice (const undecided-dos) (const raw-text-unix) (symbol :tag "other")) :group 'maplev-mint) (defcustom maplev-mint-query t - "*Non-nil means query before correcting." + "Non-nil means query before correcting." :type 'boolean :group 'maplev-mint) (defcustom maplev-mint-process-all-vars nil - "*Non-nil means process all variables in one step." + "Non-nil means process all variables in one step." :type 'boolean :group 'maplev-mint) (defcustom maplev-mint-include-dir nil - "*Directory of mint include files. + "Directory of mint include files. This should probably be a list of directories." :type 'string :group 'maplev-mint) - ;;}}} ;;{{{ syntax table @@ -4259,7 +4799,6 @@ (define-key map [?s] 'isearch-forward) (define-key map [?r] 'isearch-backward) (define-key map (maplev--mouse-keymap '(2)) 'maplev-mint-click) - (define-key map [(control c) (control c)] 'maplev-mint-handler) (setq maplev-mint-mode-map map))) @@ -4657,6 +5196,7 @@ (coding-system-for-read maplev-mint-coding-system) (mint-buffer (concat "*Mint " maplev-release "*")) (mint (nth 2 (cdr (assoc maplev-release maplev-executable-alist)))) + (include-path maplev-include-path) status eoi lines errpos) ;; Allocate markers, unless they exist (unless maplev-mint--code-beginning @@ -4664,12 +5204,10 @@ maplev-mint--code-end (make-marker))) (set-marker maplev-mint--code-beginning beg) (set-marker maplev-mint--code-end end) - (save-excursion - (set-buffer (get-buffer-create mint-buffer)) + (with-current-buffer (get-buffer-create mint-buffer) (setq buffer-read-only nil)) (copy-to-buffer mint-buffer beg end) - (save-excursion - (set-buffer mint-buffer) + (with-current-buffer mint-buffer (goto-char (point-max)) ;; Add a blank line to the end of the buffer, unless there is ;; one already. This is needed for mint to work properly. @@ -4684,9 +5222,9 @@ (concat "-i" (number-to-string maplev-mint-info-level) ;; Add include path to argument list. ;; Use commas to separate directories (see ?mint) - (and maplev-include-path - (concat " -I " - (mapconcat 'identity maplev-include-path ",")))) + (and include-path + (concat " -s -I " + (mapconcat 'identity include-path ",")))) maplev-mint-start-options)) (delete-region (point-min) eoi) ;; Display Mint output @@ -4885,6 +5423,8 @@ ;;}}} + (provide 'maplev) +(provide 'maplev-mode) ;;; maplev.el ends here \ No newline at end of file diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/maplev.texi emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/maplev.texi --- emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/maplev.texi 2015-06-14 19:01:23.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/maplev.texi 2016-12-06 13:46:16.000000000 +0000 @@ -1,115 +1,79 @@ \input texinfo -@c {{{ Header }}} @setfilename maplev -@settitle MapleV Emacs Mode @value{EDITION} +@settitle MapleV Emacs Mode @value{VERSION} + +@set VERSION 2.27 +@set DATE June 2011 @dircategory Emacs @direntry -* maplev: (maplev). MapleV Emacs Mode +* MapleV: (maplev). A GNU-Emacs mode for developing Maple code. @end direntry -@c P.S. Galbraith: I don't have this file... -@c @include version.texi + +@include version.texi @iftex @tolerance 10000 @end iftex -@c $Id: maplev.texi,v 1.8 2013/12/04 22:32:10 psg Exp $ +@copying +MapleV is a GNU Emacs major mode for developing source code for @w{Maple}, +a computer algebra system (CAS) marketed by @w{Waterloo Maple Inc}. +In this manual @dfn{MapleV} refers to the Emacs major mode and +@dfn{Maple} to the CAS. MapleV is written entirely in Emacs-Lisp and is +distributed under the GNU General Public License. -@ifinfo -This file documents MapleV, a GNU Emacs major mode for developing code for -Maple, a computer algebra system (CAS) produced by Waterloo Maple Inc. +This manual is for MapleV version @value{VERSION}. -Copyright (C) 1999 -Joseph S. Riel +Copyright @copyright{} 2011, Joseph S. Riel -This edition is for MapleV version @value{EDITION}. +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover texts, and with no Back-Cover +Texts. A copy of the license is included in the section entitled +``GNU Free Documentation License.'' +@end quotation +@end copying -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Free Software Foundation. -@end ifinfo -@c {{{endfold}}} -@c {{{ Titlepage and Copyright }}} @setchapternewpage on @titlepage @title MapleV @subtitle A GNU Emacs Mode for Maple Developers -@subtitle Edition @value{EDITION}, for MapleV Version @value{VERSION} -@subtitle @value{UPDATED} +@subtitle For MapleV Version @value{VERSION} +@c @subtitle @value{UPDATED} @author Joseph S.@ Riel @page @vskip 0pt plus 1filll Maple is a registered trademarks of Waterloo Maple Inc.@* -Copyright @copyright{} 1999 Joseph S. Riel@* +Copyright @copyright{} 1999, 2010 Joseph S. Riel@* Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). -@end ignore - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``Copying'' is included exactly as in the original, and -provided that the entire resulting derived work is distributed under the -terms of a permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation -approved by the Free Software Foundation. @end titlepage @page -@c {{{endfold}}} -@c {{{ Top Node and Master Menu }}} -@ifinfo +@ifnottex @node top, Copying, (dir), (dir) @top MapleV -MapleV is a GNU Emacs major mode for developing source code for @w{Maple}, -a computer algebra system (CAS) marketed by @w{Waterloo Maple Inc}. -In this manual @dfn{MapleV} refers to the Emacs major mode and -@dfn{Maple} to the CAS. MapleV is written entirely in Emacs-Lisp and is -distributed under the GNU General Public License. - -This is the documentation for MapleV version @value{VERSION}. - -@end ifinfo +@insertcopying +@end ifnottex @menu * Copying:: Conditions for copying and changing MapleV. +* GNU Free Documentation License:: Copying this manual. * Introduction:: A brief tour of MapleV's features. * Basics:: A few basics. @@ -120,6 +84,7 @@ * Comments:: Command for adding and aligning comments. * Shortcuts:: Abbreviations and templates. * Imenu support:: Creating a procedure index. +* Miscellaneous features:: Useful editing features Processes @@ -138,7 +103,6 @@ * Key Index:: * Function Index:: * Variable Index:: -* Concept Index:: @detailmenu --- The Detailed Node Listing --- @@ -170,6 +134,10 @@ * Customizing Abbreviations:: +Miscellaneous features + +* Include statements:: Active include statements + Mint * Running mint:: Commands for sending code to Mint. @@ -205,10 +173,7 @@ @end detailmenu @end menu -@c {{{endfold}}} -@c {{{ Copying }}} - -@node Copying, Introduction, top, top +@node Copying, GNU Free Documentation License, top, top @unnumbered Copying @cindex Copying @cindex Copyright @@ -256,9 +221,15 @@ -@c {{{endfold}}} -@c {{{ Introduction }}} -@node Introduction, Basics, Copying, top + + +@node GNU Free Documentation License, Introduction, Copying, top +@unnumbered GNU Free Documentation License +@include fdl.texi + + + +@node Introduction, Basics, GNU Free Documentation License, top @unnumbered Introduction @cindex Introduction @@ -338,10 +309,6 @@ -@c {{{endfold}}} - -@c {{{ Basics }}} - @node Basics, Indentation, Introduction, top @chapter Basics @cindex Top-level procedures @@ -362,9 +329,7 @@ text, are available on the menubar. -@c {{{endfold}}} -@c {{{ Indentation }}} @node Indentation, Font Lock, Basics, top @comment node-name, next, previous, up @@ -384,7 +349,6 @@ * Indentation Details:: Overview of the indentation algorithm. @end menu -@c {{{ commands }}} @node Indentation Commands, Customizing Indentation, Indentation, Indentation @comment node-name, next, previous, up @@ -425,8 +389,6 @@ @end table -@c {{{endfold}}} -@c {{{ customizing }}} @node Customizing Indentation, Indentation Tricks, Indentation Commands, Indentation @comment node-name, next, previous, up @@ -452,8 +414,6 @@ @end vtable -@c {{{endfold}}} -@c {{{ tricks }}} @node Indentation Tricks, Indentation Details, Customizing Indentation, Indentation @section Indentation Tricks @@ -467,7 +427,6 @@ * Preventing indentation:: Using continued comments to prevent indentation. @end menu -@c {{{ forcing indentation }}} @node Forcing indentation, Preventing indentation, Indentation Tricks, Indentation Tricks @subsection Forcing indentation @@ -512,13 +471,10 @@ ---------- Buffer: foo ---------- @end example -@c {{{endfold}}} -@c {{{ preventing indentation }}} @node Preventing indentation, , Forcing indentation, Indentation Tricks @subsection Preventing indentation -@cindex Preventing indentation -@cindex Indentation, preventing + @subsubheading Problem Consider an installation script in which the procedures @samp{foo1} and @@ -578,11 +534,8 @@ the comments and so matches the initial @code{if} to the final @code{fi}; it ignores the dummy statements. -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ details }}} @node Indentation Details, , Indentation Tricks, Indentation @section Indentation Details @@ -606,10 +559,7 @@ consequently, you may occasionally notice small delays as the source is reparsed. -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ Font Lock }}} @node Font Lock, Comments, Indentation, top @chapter Font Lock @@ -622,7 +572,6 @@ * Display faces:: Setting the display faces. @end menu -@c {{{ decoration level }}} @node Decoration level, Adding keywords, Font Lock, Font Lock @section Decoration level @@ -656,8 +605,6 @@ use the menubar, @kbd{MapleV -> Setup -> Decoration}, to change the decoration in a MapleV buffer. @code{LEVEL} is an integer from 1 to 3. -@c {{{endfold}}} -@c {{{ adding keywords }}} @node Adding keywords, Display faces, Decoration level, Font Lock @@ -678,8 +625,6 @@ ("printf" . maplev-font-special-word-face))) @end example -@c {{{endfold}}} -@c {{{ faces }}} @node Display faces, , Adding keywords, Font Lock @section Display faces @@ -702,10 +647,7 @@ @end vtable -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ Comments }}} @node Comments, Shortcuts, Font Lock, top @chapter Comments @@ -774,8 +716,6 @@ indentation grammar; however, it can also be used to achieve certain effects. @xref{Preventing indentation}, for an example. -@c {{{endfold}}} -@c {{{ Shortcuts }}} @node Shortcuts, Imenu support, Comments, top @chapter Shortcuts @@ -786,7 +726,6 @@ * Templates:: Inserting procedures and assignments. @end menu -@c {{{ abbreviations }}} @node Abbreviations, Templates, Shortcuts, Shortcuts @section Abbreviations @@ -816,7 +755,6 @@ @end menu -@c {{{ customizing }}} @node Customizing Abbreviations, , Abbreviations, Abbreviations @@ -844,10 +782,7 @@ @end example -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ templates }}} @node Templates, , Abbreviations, Shortcuts @section Templates @@ -898,12 +833,9 @@ @end vtable -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ Imenu support }}} -@node Imenu support, Mint, Shortcuts, top +@node Imenu support, Miscellaneous features, Shortcuts, top @chapter Imenu support @cindex Imenu @cindex Index, procedures @@ -920,11 +852,39 @@ The assignments must be flush left to be indexed. Only the first macro in a @code{macro} assignment is indexed. -@c {{{endfold}}} +@node Miscellaneous features, Mint, Imenu support, top +@comment node-name, next, previous, up +@chapter Miscellaneous features +@cindex Miscellaneous -@c {{{ Mint }}} +@menu +* Include statements:: Active include statements +@end menu -@node Mint, Maple, Imenu support, top +@node Include statements, , Miscellaneous features, Miscellaneous features +@section Include statements +@cindex Include + +@findex maplev-find-include-file-at-point +Maple include statements, such as @code{$include }, +are font-locked and active. +Clicking on them, or typing @kbd{C-c C-o}, +calls @kbd{maplev-find-include-file-at-point}, +which searches for the file and, if successful, opens it. +If the path exists, but the file does not, the user is +asked whether to create the file. + +@vindex maplev-include-path +The include path can be +assigned, as a list of strings, to the variable @kbd{maplev-include-path}. +The paths are searched in the order of occurrence in the list. + +@vindex maplev-include-file-other-window-flag +The customizable variable @kbd{maplev-include-file-other-window-flag} +determines whether the file is opened in the current window or +another window. + +@node Mint, Maple, Miscellaneous features, top @chapter Mint @cindex Mint @cindex Syntax checking @@ -941,7 +901,6 @@ * Mint mode:: Mode for viewing the output of Mint. @end menu -@c {{{ running mint }}} @node Running mint, Mint mode, Mint, Mint @section Running mint @@ -996,8 +955,6 @@ @end vtable -@c {{{endfold}}} -@c {{{ Mint mode }}} @node Mint mode, , Running mint, Mint @section Mint mode @@ -1051,10 +1008,7 @@ @end vtable -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ Cmaple }}} @node Maple, Help pages, Mint, top @chapter Maple @@ -1070,7 +1024,6 @@ * Cmaple mode:: Mode for interacting with Maple. @end menu -@c {{{ running maple }}} @node Running Maple, Cmaple mode, Maple, Maple @section Running Maple @@ -1117,8 +1070,6 @@ These commands are available through the menubar, @kbd{MapleV -> Maple}. -@c {{{endfold}}} -@c {{{ cmaple mode }}} @node Cmaple mode, , Running Maple, Maple @section Cmaple mode @@ -1127,6 +1078,7 @@ The command line version of Maple is run in a buffer with the mode @code{cmaple-process-mode} that is based on @code{comint-mode}. +@inforef{Shell Mode,,emacs} for more information. In addition to the normal @code{comint} commands, the following commands are available: @@ -1140,10 +1092,7 @@ @end table -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ Help }}} @node Help pages, Procedures, Maple, top @chapter Help pages @@ -1159,7 +1108,6 @@ * MapleV help mode:: Mode for viewing Maple help pages. @end menu -@c {{{ displaying help pages }}} @node Displaying help pages, MapleV help mode, Help pages, Help pages @section Displaying help pages @@ -1189,8 +1137,6 @@ @xref{MapleV help mode}. @end ifinfo -@c {{{endfold}}} -@c {{{ help mode }}} @node MapleV help mode, , Displaying help pages, Help pages @section MapleV help mode @@ -1253,10 +1199,7 @@ Maple engine is busy an error message, @samp{Maple busy}, is displayed in the message window. -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ Proc }}} @node Procedures, Installation, Help pages, top @chapter Procedures @@ -1273,7 +1216,6 @@ * MapleV proc mode:: Mode for viewing Maple procedures. @end menu -@c {{{ displaying procedures }}} @node Displaying procedures, MapleV proc mode, Procedures, Procedures @section Displaying procedures @@ -1303,8 +1245,6 @@ @xref{MapleV proc mode}. @end ifinfo -@c {{{endfold}}} -@c {{{ proc mode }}} @node MapleV proc mode, , Displaying procedures, Procedures @section MapleV proc mode @@ -1359,13 +1299,10 @@ started. If the Maple engine is busy an error message, @samp{Maple busy}, is displayed in the message window. -@c {{{endfold}}} -@c {{{endfold}}} @c Appendices -@c {{{ Installation }}} @node Installation, Evolution, Procedures, top @appendix Installation @@ -1384,7 +1321,6 @@ @end menu -@c {{{ compiling }}} @node Compiling, Customizing, Installation, Installation @section Compiling @@ -1411,8 +1347,6 @@ (cons `("\\.mpl\\'" . maplev-mode) auto-mode-alist)) @end example -@c {{{endfold}}} -@c {{{ customizing }}} @node Customizing, Info documentation, Compiling, Installation @section Customizing @@ -1433,8 +1367,6 @@ After setting these options, save them to your @file{.emacs} file by clicking on the @samp{Save for Future Sessions} button. -@c {{{endfold}}} -@c {{{ installing info docs }}} @node Info documentation, , Customizing, Installation @section Info documentation @@ -1454,15 +1386,11 @@ @end example -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ Evolution }}} @node Evolution, Key Index, Installation, top @appendix Evolution -@c {{{ Bugs }}} @menu * Bugs:: @@ -1479,8 +1407,6 @@ Joseph S. Riel (Joe Riel) @samp{joer@@k-online.com} -@c {{{endfold}}} -@c {{{ Acknowledgements }}} @node Acknowledgments, Enhancements, Bugs, Evolution @section Acknowledgements @@ -1519,8 +1445,6 @@ @end table -@c {{{endfold}}} -@c {{{ Enhancements }}} @node Enhancements, , Acknowledgments, Evolution @section Enhancements @@ -1548,11 +1472,8 @@ @end itemize -@c {{{endfold}}} -@c {{{endfold}}} -@c {{{ Indices and Endmatter }}} @node Key Index, Function Index, Evolution, top @comment node-name, next, previous, up @@ -1566,20 +1487,15 @@ @printindex fn -@node Variable Index, Concept Index, Function Index, top +@node Variable Index, , Function Index, top @comment node-name, next, previous, up @unnumbered Variable Index @printindex vr -@node Concept Index, , Variable Index, top -@comment node-name, next, previous, up -@unnumbered Concept Index - @printindex cp @summarycontents @contents @bye -@c {{{endfold}}} diff -Nru emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/markdown-mode.el emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/markdown-mode.el --- emacs-goodies-el-35.12ubuntu3/elisp/emacs-goodies-el/markdown-mode.el 2015-06-14 18:42:15.000000000 +0000 +++ emacs-goodies-el-36.3ubuntu1/elisp/emacs-goodies-el/markdown-mode.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,4669 +0,0 @@ -;;; markdown-mode.el --- Emacs Major mode for Markdown-formatted text files - -;; Copyright (C) 2007-2013 Jason R. Blevins -;; Copyright (C) 2007, 2009 Edward O'Connor -;; Copyright (C) 2007 Conal Elliott -;; Copyright (C) 2008 Greg Bognar -;; Copyright (C) 2008 Dmitry Dzhus -;; Copyright (C) 2008 Bryan Kyle -;; Copyright (C) 2008 Ben Voui -;; Copyright (C) 2009 Ankit Solanki -;; Copyright (C) 2009 Hilko Bengen -;; Copyright (C) 2009 Peter Williams -;; Copyright (C) 2010 George Ogata -;; Copyright (C) 2011 Eric Merritt -;; Copyright (C) 2011 Philippe Ivaldi -;; Copyright (C) 2011 Jeremiah Dodds -;; Copyright (C) 2011 Christopher J. Madsen -;; Copyright (C) 2011 Shigeru Fukaya -;; Copyright (C) 2011 Joost Kremers -;; Copyright (C) 2011-2012 Donald Ephraim Curtis -;; Copyright (C) 2012 Akinori Musha -;; Copyright (C) 2012 Zhenlei Jia -;; Copyright (C) 2012 Peter Jones -;; Copyright (C) 2013 Matus Goljer - -;; Author: Jason R. Blevins -;; Maintainer: Jason R. Blevins -;; Created: May 24, 2007 -;; Version: 2.0 -;; Keywords: Markdown, GitHub Flavored Markdown, itex -;; URL: http://jblevins.org/projects/markdown-mode/ - -;; This file is not part of GNU Emacs. - -;; This program 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. - -;; This program 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 this program; if not, write to the Free Software -;; Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;; markdown-mode is a major mode for editing [Markdown][]-formatted -;; text files in GNU Emacs. markdown-mode is free software, licensed -;; under the GNU GPL. -;; -;; [Markdown]: http://daringfireball.net/projects/markdown/ -;; -;; The latest stable version is markdown-mode 2.0, released on March 24, 2013: -;; -;; * [markdown-mode.el][] -;; * [Screenshot][][^theme] -;; * [Release notes][] -;; -;; [markdown-mode.el]: http://jblevins.org/projects/markdown-mode/markdown-mode.el -;; [screenshot]: http://jblevins.org/projects/markdown-mode/screenshots/20130131-002.png -;; [release notes]: http://jblevins.org/projects/markdown-mode/rev-2-0 -;; -;; [^theme]: The theme used in the screenshot is -;; [color-theme-twilight](https://github.com/crafterm/twilight-emacs). -;; -;; markdown-mode is also available in several package managers, including: -;; -;; * Debian and Ubuntu Linux: [emacs-goodies-el][] -;; * RedHat and Fedora Linux: [emacs-goodies][] -;; * OpenBSD: [textproc/markdown-mode][] -;; * Arch Linux (AUR): [emacs-markdown-mode-git][] -;; * MacPorts: [markdown-mode.el][macports-package] ([pending][macports-ticket]) -;; * FreeBSD: [textproc/markdown-mode.el][freebsd-port] -;; -;; [emacs-goodies-el]: http://packages.debian.org/emacs-goodies-el -;; [emacs-goodies]: https://admin.fedoraproject.org/pkgdb/acls/name/emacs-goodies -;; [textproc/markdown-mode]: http://pkgsrc.se/textproc/markdown-mode -;; [emacs-markdown-mode-git]: http://aur.archlinux.org/packages.php?ID=30389 -;; [macports-package]: https://trac.macports.org/browser/trunk/dports/editors/markdown-mode.el/Portfile -;; [macports-ticket]: http://trac.macports.org/ticket/35716 -;; [freebsd-port]: http://svnweb.freebsd.org/ports/head/textproc/markdown-mode.el -;; -;; The latest development version can be downloaded directly -;; ([markdown-mode.el][devel.el]) or it can be obtained from the -;; (browsable and clonable) Git repository at -;; . The entire repository, -;; including the full project history, can be cloned via the Git protocol -;; by running -;; -;; git clone git://jblevins.org/git/markdown-mode.git -;; -;; [devel.el]: http://jblevins.org/git/markdown-mode.git/plain/markdown-mode.el - -;;; Installation: - -;; Make sure to place `markdown-mode.el` somewhere in the load-path and add -;; the following lines to your `.emacs` file to associate markdown-mode -;; with `.text`, `.markdown`, and `.md` files: -;; -;; (autoload 'markdown-mode "markdown-mode" -;; "Major mode for editing Markdown files" t) -;; (add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode)) -;; (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) -;; (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) -;; -;; There is no official Markdown file extension, nor is there even a -;; _de facto_ standard, so you can easily add, change, or remove any -;; of the file extensions above as needed. - -;;; Usage: - -;; Keybindings are grouped by prefixes based on their function. For -;; example, the commands for inserting links are grouped under `C-c -;; C-a`, where the `C-a` is a mnemonic for the HTML `` tag. In -;; other cases, the connection to HTML is not direct. For example, -;; commands dealing with headings begin with `C-c C-t` (mnemonic: -;; titling). The primary commands in each group will are described -;; below. You can obtain a list of all keybindings by pressing `C-c -;; C-h`. Movement and shifting commands tend to be associated with -;; paired delimiters such as `M-{` and `M-}` or `C-c <` and `C-c >`. -;; Outline navigation keybindings the same as in `org-mode'. Finally, -;; commands for running Markdown or doing maintenance on an open file -;; are grouped under the `C-c C-c` prefix. The most commonly used -;; commands are described below. You can obtain a list of all -;; keybindings by pressing `C-c C-h`. -;; -;; * Hyperlinks: `C-c C-a` -;; -;; In this group, `C-c C-a l` inserts an inline link of the form -;; `[text](url)`. The link text is determined as follows. First, -;; if there is an active region (i.e., when transient mark mode is -;; on and the mark is active), use it as the link text. Second, -;; if the point is at a word, use that word as the link text. In -;; these two cases, the original text will be replaced with the -;; link and point will be left at the position for inserting a -;; URL. Otherwise, insert empty link markup and place the point -;; for inserting the link text. -;; -;; `C-c C-a L` inserts a reference link of the form `[text][label]` -;; and, optionally, a corresponding reference label definition. -;; The link text is determined in the same way as with an inline -;; link (using the region, when active, or the word at the point), -;; but instead of inserting empty markup as a last resort, the -;; link text will be read from the minibuffer. The reference -;; label will be read from the minibuffer in both cases, with -;; completion from the set of currently defined references. To -;; create an implicit reference link, press `RET` to accept the -;; default, an empty label. If the entered referenced label is -;; not defined, additionally prompt for the URL and (optional) -;; title. If a URL is provided, a reference definition will be -;; inserted in accordance with `markdown-reference-location'. -;; If a title is given, it will be added to the end of the -;; reference definition and will be used to populate the title -;; attribute when converted to XHTML. -;; -;; `C-c C-a u` inserts a bare url, delimited by angle brackets. When -;; there is an active region, the text in the region is used as the -;; URL. If the point is at a URL, that url is used. Otherwise, -;; insert angle brackets and position the point in between them -;; for inserting the URL. -;; -;; `C-c C-a f` inserts a footnote marker at the point, inserts a -;; footnote definition below, and positions the point for -;; inserting the footnote text. Note that footnotes are an -;; extension to Markdown and are not supported by all processors. -;; -;; `C-c C-a w` behaves much like the inline link insertion command -;; and inserts a wiki link of the form `[[WikiLink]]`. If there -;; is an active region, use the region as the link text. If the -;; point is at a word, use the word as the link text. If there is -;; no active region and the point is not at word, simply insert -;; link markup. Note that wiki links are an extension to Markdown -;; and are not supported by all processors. -;; -;; * Images: `C-c C-i` -;; -;; `C-c C-i i` inserts markup for an inline image, using the -;; active region or the word at point, if any, as the alt text. -;; `C-c C-i I` behaves similarly and inserts a reference-style -;; image. -;; -;; * Styles: `C-c C-s` -;; -;; `C-c C-s e` inserts markup to make a region or word italic (`e` -;; for `` or emphasis). If there is an active region, make -;; the region italic. If the point is at a non-italic word, make -;; the word italic. If the point is at an italic word or phrase, -;; remove the italic markup. Otherwise, simply insert italic -;; delimiters and place the cursor in between them. Similarly, -;; use `C-c C-s s` for bold (``) and `C-c C-s c` for -;; inline code (``). -;; -;; `C-c C-s b` inserts a blockquote using the active region, if any, -;; or starts a new blockquote. `C-c C-s C-b` is a variation which -;; always operates on the region, regardless of whether it is -;; active or not. The appropriate amount of indentation, if any, -;; is calculated automatically given the surrounding context, but -;; may be adjusted later using the region indentation commands. -;; -;; `C-c C-s p` behaves similarly for inserting preformatted code -;; blocks, with `C-c C-s C-p` being the region-only counterpart. -;; -;; * Headings: `C-c C-t` -;; -;; All heading insertion commands use the text in the active -;; region, if any, as the heading text. Otherwise, if the current -;; line is not blank, they use the text on the current line. -;; Finally, the setext commands will prompt for heading text if -;; there is no active region and the current line is blank. -;; -;; `C-c C-t h` inserts a heading with automatically chosen type and -;; level (both determined by the previous heading). `C-c C-t H` -;; behaves similarly, but uses setext (underlined) headings when -;; possible, still calculating the level automatically. -;; In cases where the automatically-determined level is not what -;; you intended, the level can be quickly promoted or demoted -;; (as described below). Alternatively, a `C-u` prefix can be -;; given to insert a heading promoted by one level or a `C-u C-u` -;; prefix can be given to insert a heading demoted by one level. -;; -;; To insert a heading of a specific level and type, use `C-c C-t 1` -;; through `C-c C-t 6` for atx (hash mark) headings and `C-c C-t !` or -;; `C-c C-t @` for setext headings of level one or two, respectively. -;; Note that `!` is `S-1` and `@` is `S-2`. -;; -;; If the point is at a heading, these commands will replace the -;; existing markup in order to update the level and/or type of the -;; heading. To remove the markup of the heading at the point, -;; press `C-c C-k` to kill the heading and press `C-y` to yank the -;; heading text back into the buffer. -;; -;; * Horizontal Rules: `C-c -` -;; -;; `C-c -` inserts a horizontal rule. By default, insert the -;; first string in the list `markdown-hr-strings' (the most -;; prominent rule). With a `C-u` prefix, insert the last string. -;; With a numeric prefix `N`, insert the string in position `N` -;; (counting from 1). -;; -;; * Markdown and Maintenance Commands: `C-c C-c` -;; -;; *Compile:* `C-c C-c m` will run Markdown on the current buffer -;; and show the output in another buffer. *Preview*: `C-c C-c p` -;; runs Markdown on the current buffer and previews, stores the -;; output in a temporary file, and displays the file in a browser. -;; *Export:* `C-c C-c e` will run Markdown on the current buffer -;; and save the result in the file `basename.html`, where -;; `basename` is the name of the Markdown file with the extension -;; removed. *Export and View:* press `C-c C-c v` to export the -;; file and view it in a browser. **For both export commands, the -;; output file will be overwritten without notice.** -;; *Open:* `C-c C-c o` will open the Markdown source file directly -;; using `markdown-open-command'. -;; -;; To summarize: -;; -;; - `C-c C-c m`: `markdown-command' > `*markdown-output*` buffer. -;; - `C-c C-c p`: `markdown-command' > temporary file > browser. -;; - `C-c C-c e`: `markdown-command' > `basename.html`. -;; - `C-c C-c v`: `markdown-command' > `basename.html` > browser. -;; - `C-c C-c w`: `markdown-command' > kill ring. -;; - `C-c C-c o`: `markdown-open-command'. -;; -;; `C-c C-c c` will check for undefined references. If there are -;; any, a small buffer will open with a list of undefined -;; references and the line numbers on which they appear. In Emacs -;; 22 and greater, selecting a reference from this list and -;; pressing `RET` will insert an empty reference definition at the -;; end of the buffer. Similarly, selecting the line number will -;; jump to the corresponding line. -;; -;; `C-c C-c n` renumbers any ordered lists in the buffer that are -;; out of sequence. -;; -;; `C-c C-c ]` completes all headings and normalizes all horizontal -;; rules in the buffer. -;; -;; * Following Links: `C-c C-o` -;; -;; Press `C-c C-o` when the point is on an inline or reference -;; link to open the URL in a browser. When the point is at a -;; wiki link, open it in another buffer (in the current window, -;; or in the other window with the `C-u` prefix). Use `M-p` and -;; `M-n` to quickly jump to the previous or next link of any type. -;; -;; * Jumping: `C-c C-j` -;; -;; Use `C-c C-j` to jump from the object at point to its counterpart -;; elsewhere in the text, when possible. Jumps between reference -;; links and definitions; between footnote markers and footnote -;; text. If more than one link uses the same reference name, a -;; new buffer will be created containing clickable buttons for jumping -;; to each link. You may press `TAB` or `S-TAB` to jump between -;; buttons in this window. -;; -;; * Promotion and Demotion: `C-c C--` and `C-c C-=` -;; -;; Headings, horizontal rules, and list items can be promoted and -;; demoted, as well as bold and italic text. For headings, -;; "promotion" means *decreasing* the level (i.e., moving from -;; `

` to `

`) while "demotion" means *increasing* the -;; level. For horizontal rules, promotion and demotion means -;; moving backward or forward through the list of rule strings in -;; `markdown-hr-strings'. For bold and italic text, promotion and -;; demotion means changing the markup from underscores to asterisks. -;; Press `C-c C--` or `M-LEFT` to promote the element at the point -;; if possible. -;; -;; To remember these commands, note that `-` is for decreasing the -;; level (promoting), and `=` (on the same key as `+`) is for -;; increasing the level (demoting). Similarly, the left and right -;; arrow keys indicate the direction that the atx heading markup -;; is moving in when promoting or demoting. -;; -;; * Completion: `C-c C-]` -;; -;; Complete markup is in normalized form, which means, for -;; example, that the underline portion of a setext header is the -;; same length as the heading text, or that the number of leading -;; and trailing hash marks of an atx header are equal and that -;; there is no extra whitespace in the header text. `C-c C-]` -;; completes the markup at the point, if it is determined to be -;; incomplete. -;; -;; * Editing Lists: `M-RET`, `M-UP`, `M-DOWN`, `M-LEFT`, and `M-RIGHT` -;; -;; New list items can be inserted with `M-RET`. This command -;; determines the appropriate marker (one of the possible -;; unordered list markers or the next number in sequence for an -;; ordered list) and indentation level by examining nearby list -;; items. If there is no list before or after the point, start a -;; new list. Prefix this command by `C-u` to decrease the -;; indentation by one level. Prefix this command by `C-u C-u` to -;; increase the indentation by one level. -;; -;; Existing list items can be moved up or down with `M-UP` or -;; `M-DOWN` and indented or exdented with `M-RIGHT` or `M-LEFT`. -;; -;; * Shifting the Region: `C-c <` and `C-c >` -;; -;; Text in the region can be indented or exdented as a group using -;; `C-c >` to indent to the next indentation point (calculated in -;; the current context), and `C-c <` to exdent to the previous -;; indentation point. These keybindings are the same as those for -;; similar commands in `python-mode'. -;; -;; * Killing Elements: `C-c C-k` -;; -;; Press `C-c C-k` to kill the thing at point and add important -;; text, without markup, to the kill ring. Possible things to -;; kill include (roughly in order of precedece): inline code, -;; headings, horizonal rules, links (add link text to kill ring), -;; images (add alt text to kill ring), angle URIs, email -;; addresses, bold, italics, reference definitions (add URI to -;; kill ring), footnote markers and text (kill both marker and -;; text, add text to kill ring), and list items. -;; -;; * Outline Navigation: `C-c C-n`, `C-c C-p`, `C-c C-f`, `C-c C-b`, and `C-c C-u` -;; -;; Navigation between headings is possible using `outline-mode'. -;; Use `C-c C-n` and `C-c C-p` to move between the next and previous -;; visible headings. Similarly, `C-c C-f` and `C-c C-b` move to the -;; next and previous visible headings at the same level as the one -;; at the point. Finally, `C-c C-u` will move up to a lower-level -;; (higher precedence) visible heading. -;; -;; * Movement by Paragraph or Block: `M-{` and `M-}` -;; -;; The definition of a "paragraph" is slightly different in -;; markdown-mode than, say, text-mode, because markdown-mode -;; supports filling for list items and respects hard line breaks, -;; both of which break paragraphs. So, markdown-mode overrides -;; the usual paragraph navigation commands `M-{` and `M-}` so that -;; with a `C-u` prefix, these commands jump to the beginning or -;; end of an entire block of text, respectively, where "blocks" -;; are separated by one or more lines. -;; -;; * Movement by Defun: `C-M-a`, `C-M-e`, and `C-M-h` -;; -;; The usual Emacs commands can be used to move by defuns -;; (top-level major definitions). In markdown-mode, a defun is a -;; section. As usual, `C-M-a` will move the point to the -;; beginning of the current or preceding defun, `C-M-e` will move -;; to the end of the current or following defun, and `C-M-h` will -;; put the region around the entire defun. -;; -;; As noted, many of the commands above behave differently depending -;; on whether Transient Mark mode is enabled or not. When it makes -;; sense, if Transient Mark mode is on and the region is active, the -;; command applies to the text in the region (e.g., `C-c C-s s` makes the -;; region bold). For users who prefer to work outside of Transient -;; Mark mode, since Emacs 22 it can be enabled temporarily by pressing -;; `C-SPC C-SPC`. When this is not the case, many commands then -;; proceed to look work with the word or line at the point. -;; -;; When applicable, commands that specifically act on the region even -;; outside of Transient Mark mode have the same keybinding as their -;; standard counterpart, but the letter is uppercase. For example, -;; `markdown-insert-blockquote' is bound to `C-c C-s b` and only acts on -;; the region in Transient Mark mode while `markdown-blockquote-region' -;; is bound to `C-c C-s B` and always applies to the region (when nonempty). -;; -;; Note that these region-specific functions are useful in many -;; cases where it may not be obvious. For example, yanking text from -;; the kill ring sets the mark at the beginning of the yanked text -;; and moves the point to the end. Therefore, the (inactive) region -;; contains the yanked text. So, `C-y` followed by `C-c C-s C-b` will -;; yank text and turn it into a blockquote. -;; -;; markdown-mode attempts to be flexible in how it handles -;; indentation. When you press `TAB` repeatedly, the point will cycle -;; through several possible indentation levels corresponding to things -;; you might have in mind when you press `RET` at the end of a line or -;; `TAB`. For example, you may want to start a new list item, -;; continue a list item with hanging indentation, indent for a nested -;; pre block, and so on. Exdention is handled similarly when backspace -;; is pressed at the beginning of the non-whitespace portion of a line. -;; -;; markdown-mode supports outline-minor-mode as well as org-mode-style -;; visibility cycling for atx- or hash-style headings. There are two -;; types of visibility cycling: Pressing `S-TAB` cycles globally between -;; the table of contents view (headings only), outline view (top-level -;; headings only), and the full document view. Pressing `TAB` while the -;; point is at a heading will cycle through levels of visibility for the -;; subtree: completely folded, visible children, and fully visible. -;; Note that mixing hash and underline style headings will give undesired -;; results. - -;;; Customization: - -;; Although no configuration is *necessary* there are a few things -;; that can be customized. The `M-x customize-mode` command -;; provides an interface to all of the possible customizations: -;; -;; * `markdown-command' - the command used to run Markdown (default: -;; `markdown`). This variable may be customized to pass -;; command-line options to your Markdown processor of choice. -;; -;; * `markdown-command-needs-filename' - set to `t' if -;; `markdown-command' does not accept standard input (default: -;; `nil'). When `nil', `markdown-mode' will pass the Markdown -;; content to `markdown-command' using standard input (`stdin`). -;; When set to `t', `markdown-mode' will pass the name of the file -;; as the final command-line argument to `markdown-command'. Note -;; that in the latter case, you will only be able to run -;; `markdown-command' from buffers which are visiting a file. -;; -;; * `markdown-open-command' - the command used for calling a standalone -;; Markdown previewer which is capable of opening Markdown source files -;; directly (default: `nil'). This command will be called -;; with a single argument, the filename of the current buffer. -;; A representative program is the Mac app [Marked][], a -;; live-updating MultiMarkdown previewer which has a command line -;; utility at `/usr/local/bin/mark`. -;; -;; * `markdown-hr-strings' - list of strings to use when inserting -;; horizontal rules. Different strings will not be distinguished -;; when converted to HTML--they will all be converted to -;; `
`--but they may add visual distinction and style to plain -;; text documents. To maintain some notion of promotion and -;; demotion, keep these sorted from largest to smallest. -;; -;; * `markdown-bold-underscore' - set to a non-nil value to use two -;; underscores for bold instead of two asterisks (default: `nil'). -;; -;; * `markdown-italic-underscore' - set to a non-nil value to use -;; underscores for italic instead of asterisks (default: `nil'). -;; -;; * `markdown-indent-function' - the function to use for automatic -;; indentation (default: `markdown-indent-line'). -;; -;; * `markdown-indent-on-enter' - set to a non-nil value to -;; automatically indent new lines when the enter key is pressed -;; (default: `t') -;; -;; * `markdown-wiki-link-alias-first' - set to a non-nil value to -;; treat aliased wiki links like `[[link text|PageName]]` -;; (default: `t'). When set to nil, they will be treated as -;; `[[PageName|link text]]'. -;; -;; * `markdown-uri-types' - a list of protocol schemes (e.g., "http") -;; for URIs that `markdown-mode' should highlight. -;; -;; * `markdown-enable-math' - syntax highlighting for LaTeX -;; fragments (default: `nil'). Set this to `t' to turn on math -;; support by default. Math support can be toggled later using -;; the function `markdown-enable-math'." -;; -;; * `markdown-css-path' - CSS file to link to in XHTML output -;; (default: `""`). -;; -;; * `markdown-content-type' - when set to a nonempty string, an -;; `http-equiv` attribute will be included in the XHTML `` -;; block (default: `""`). If needed, the suggested values are -;; `application/xhtml+xml` or `text/html`. See also: -;; `markdown-coding-system'. -;; -;; * `markdown-coding-system' - used for specifying the character -;; set identifier in the `http-equiv` attribute when included -;; (default: `nil'). See `markdown-content-type', which must -;; be set before this variable has any effect. When set to `nil', -;; `buffer-file-coding-system' will be used to automatically -;; determine the coding system string (falling back to -;; `iso-8859-1' when unavailable). Common settings are `utf-8' -;; and `iso-latin-1'. -;; -;; * `markdown-xhtml-header-content' - additional content to include -;; in the XHTML `` block (default: `""`). -;; -;; * `markdown-xhtml-standalone-regexp' - a regular expression which -;; `markdown-mode' uses to determine whether the output of -;; `markdown-command' is a standalone XHTML document or an XHTML -;; fragment (default: `"^\\(<\\?xml\\| for Debian packaging. -;; * Conal Elliott for a font-lock regexp patch. -;; * Edward O'Connor for a font-lock regexp fix and -;; GitHub Flavored Markdown mode (`gfm-mode'). -;; * Greg Bognar for menus and running -;; `markdown' with an active region. -;; * Daniel Burrows for filing Debian bug #456592. -;; * Peter S. Galbraith for maintaining `emacs-goodies-el`. -;; * Dmitry Dzhus for undefined reference checking. -;; * Carsten Dominik for `org-mode', from which the -;; visibility cycling functionality was derived, and for a bug fix -;; related to `orgtbl-mode'. -;; * Bryan Kyle for indentation code. -;; * Ben Voui for font-lock face customizations. -;; * Ankit Solanki for `longlines.el` -;; compatibility and custom CSS. -;; * Hilko Bengen for proper XHTML output. -;; * Jose A. Ortega Ruiz for Emacs 23 fixes. -;; * Nelson Minar for `html-helper-mode', from which -;; comment matching functions were derived. -;; * Alec Resnick for bug reports. -;; * Joost Kremers for footnote-handling -;; functions, bug reports regarding indentation, and -;; fixes for byte-compilation warnings. -;; * Peter Williams for `fill-paragraph' -;; enhancements. -;; * George Ogata for fixing several -;; byte-compilation warnings. -;; * Eric Merritt for wiki link features. -;; * Philippe Ivaldi for XHTML preview -;; customizations and XHTML export. -;; * Jeremiah Dodds for supporting -;; Markdown processors which do not accept input from stdin. -;; * Werner Dittmann for bug reports -;; regarding the `cl` dependency and `auto-fill-mode' and indentation. -;; * Scott Pfister for generalizing the space -;; substitution character for mapping wiki links to filenames. -;; * Marcin Kasperski for a patch to -;; escape shell commands. -;; * Christopher J. Madsen for patches to fix a match -;; data bug and to prefer `visual-line-mode' in `gfm-mode'. -;; * Shigeru Fukaya for better adherence to -;; Emacs Lisp coding conventions. -;; * Donald Ephraim Curtis for fixing the `fill-paragraph' -;; regexp, refactoring the compilation and preview functions, -;; heading font-lock generalizations, list renumbering, -;; and kill ring save. -;; * Kevin Porter for wiki link handling in `gfm-mode'. -;; * Max Penet and Peter Eisentraut -;; for an autoload token for `gfm-mode'. -;; * Ian Yang for improving the reference definition regex. -;; * Akinori Musha for an imenu index function. -;; * Michael Sperber for XEmacs fixes. -;; * Francois Gannaz for suggesting charset -;; declaration in XHTML output. -;; * Zhenlei Jia for smart exdention function. -;; * Matus Goljer for improved wiki link following -;; and GFM code block insertion. -;; * Peter Jones for link following functions. -;; * Bryan Fink for a bug report regarding -;; externally modified files. -;; * Vegard Vesterheim for a bug fix -;; related to `orgtbl-mode'. -;; * Makoto Motohashi for before- and after- -;; export hooks and unit test improvements. -;; * Michael Dwyer for `gfm-mode' underscore regexp. -;; * Chris Lott for suggesting reference label -;; completion. - -;;; Bugs: - -;; Although markdown-mode is developed and tested primarily using -;; GNU Emacs 24, compatibility with earlier Emacsen is also a -;; priority. -;; -;; If you find any bugs in markdown-mode, please construct a test case -;; or a patch and email me at . - -;;; History: - -;; markdown-mode was written and is maintained by Jason Blevins. The -;; first version was released on May 24, 2007. -;; -;; * 2007-05-24: Version 1.1 -;; * 2007-05-25: Version 1.2 -;; * 2007-06-05: [Version 1.3][] -;; * 2007-06-29: Version 1.4 -;; * 2007-10-11: [Version 1.5][] -;; * 2008-06-04: [Version 1.6][] -;; * 2009-10-01: [Version 1.7][] -;; * 2011-08-12: [Version 1.8][] -;; * 2011-08-15: [Version 1.8.1][] -;; * 2013-01-25: [Version 1.9][] -;; * 2013-03-18: [Version 2.0][] -;; -;; [Version 1.3]: http://jblevins.org/projects/markdown-mode/rev-1-3 -;; [Version 1.5]: http://jblevins.org/projects/markdown-mode/rev-1-5 -;; [Version 1.6]: http://jblevins.org/projects/markdown-mode/rev-1-6 -;; [Version 1.7]: http://jblevins.org/projects/markdown-mode/rev-1-7 -;; [Version 1.8]: http://jblevins.org/projects/markdown-mode/rev-1-8 -;; [Version 1.8.1]: http://jblevins.org/projects/markdown-mode/rev-1-8-1 -;; [Version 1.9]: http://jblevins.org/projects/markdown-mode/rev-1-9 -;; [Version 2.0]: http://jblevins.org/projects/markdown-mode/rev-2-0 - - -;;; Code: - -(require 'easymenu) -(require 'outline) -(require 'thingatpt) -(eval-when-compile (require 'cl)) - - -;;; Constants ================================================================= - -(defconst markdown-mode-version "2.0" - "Markdown mode version number.") - -(defconst markdown-output-buffer-name "*markdown-output*" - "Name of temporary buffer for markdown command output.") - - -;;; Global Variables ========================================================== - -(defvar markdown-reference-label-history nil - "History of used reference labels.") - - -;;; Customizable Variables ==================================================== - -(defvar markdown-mode-hook nil - "Hook run when entering Markdown mode.") - -(defvar markdown-before-export-hook nil - "Hook run before running Markdown to export XHTML output. -The hook may modify the buffer, which will be restored to it's -original state after exporting is complete.") - -(defvar markdown-after-export-hook nil - "Hook run after XHTML output has been saved. -Any changes to the output buffer made by this hook will be saved.") - -(defgroup markdown nil - "Major mode for editing text files in Markdown format." - :prefix "markdown-" - :group 'wp - :link '(url-link "http://jblevins.org/projects/markdown-mode/")) - -(defcustom markdown-command "markdown" - "Command to run markdown." - :group 'markdown - :type 'string) - -(defcustom markdown-command-needs-filename nil - "Set to non-nil if `markdown-command' does not accept input from stdin. -Instead, it will be passed a filename as the final command line -option. As a result, you will only be able to run Markdown from -buffers which are visiting a file." - :group 'markdown - :type 'boolean) - -(defcustom markdown-open-command nil - "Command used for opening Markdown files directly. -For example, a standalone Markdown previewer. This command will -be called with a single argument: the filename of the current -buffer." - :group 'markdown - :type 'string) - -(defcustom markdown-hr-strings - '("-------------------------------------------------------------------------------" - "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *" - "---------------------------------------" - "* * * * * * * * * * * * * * * * * * * *" - "---------" - "* * * * *") - "Strings to use when inserting horizontal rules. -The first string in the list will be the default when inserting a -horizontal rule. Strings should be listed in decreasing order of -prominence (as in headings from level one to six) for use with -promotion and demotion functions." - :group 'markdown - :type 'list) - -(defcustom markdown-bold-underscore nil - "Use two underscores for bold instead of two asterisks." - :group 'markdown - :type 'boolean) - -(defcustom markdown-italic-underscore nil - "Use underscores for italic instead of asterisks." - :group 'markdown - :type 'boolean) - -(defcustom markdown-indent-function 'markdown-indent-line - "Function to use to indent." - :group 'markdown - :type 'function) - -(defcustom markdown-indent-on-enter t - "Automatically indent new lines when enter key is pressed. -When this variable is set to t, pressing RET will call -`newline-and-indent'. When set to nil, define RET to call -`newline' as usual. In the latter case, you can still use -auto-indentation by pressing \\[newline-and-indent]." - :group 'markdown - :type 'boolean) - -(defcustom markdown-wiki-link-alias-first t - "When non-nil, treat aliased wiki links like [[alias text|PageName]]. -Otherwise, they will be treated as [[PageName|alias text]]." - :group 'markdown - :type 'boolean) - -(defcustom markdown-uri-types - '("acap" "cid" "data" "dav" "fax" "file" "ftp" "gopher" "http" "https" - "imap" "ldap" "mailto" "mid" "modem" "news" "nfs" "nntp" "pop" "prospero" - "rtsp" "service" "sip" "tel" "telnet" "tip" "urn" "vemmi" "wais") - "Link types for syntax highlighting of URIs." - :group 'markdown - :type 'list) - -(defcustom markdown-enable-math nil - "Syntax highlighting for inline LaTeX and itex expressions. -Set this to a non-nil value to turn on math support by default. -Math support can be toggled later using `markdown-enable-math' -or \\[markdown-enable-math]." - :group 'markdown - :type 'boolean - :safe 'booleanp) - -(defcustom markdown-css-path "" - "URL of CSS file to link to in the output XHTML." - :group 'markdown - :type 'string) - -(defcustom markdown-content-type "" - "Content type string for the http-equiv header in XHTML output. -When set to a non-empty string, insert the http-equiv attribute. -Otherwise, this attribute is omitted." - :group 'markdown - :type 'string) - -(defcustom markdown-coding-system nil - "Character set string for the http-equiv header in XHTML output. -Defaults to `buffer-file-coding-system' (and falling back to -`iso-8859-1' when not available). Common settings are `utf-8' -and `iso-latin-1'. Use `list-coding-systems' for more choices." - :group 'markdown - :type 'coding-system) - -(defcustom markdown-xhtml-header-content "" - "Additional content to include in the XHTML block." - :group 'markdown - :type 'string) - -(defcustom markdown-xhtml-standalone-regexp - "^\\(<\\?xml\\|\\).*$" - "Regular expression for matching blockquote lines.") - -(defconst markdown-regex-line-break - "[^ \n\t][ \t]*\\( \\)$" - "Regular expression for matching line breaks.") - -(defconst markdown-regex-wiki-link - "\\(?:^\\|[^\\]\\)\\(\\[\\[\\([^]|]+\\)\\(|\\([^]]+\\)\\)?\\]\\]\\)" - "Regular expression for matching wiki links. -This matches typical bracketed [[WikiLinks]] as well as 'aliased' -wiki links of the form [[PageName|link text]]. In this regular -expression, group 1 matches the entire link, including square -brackets, group 2 matches the first component of the wiki link -and group 4 matches the second component, after the pipe, when -present. The meanings of the first and second components depend -on the value of `markdown-wiki-link-alias-first'.") - -(defconst markdown-regex-uri - (concat (regexp-opt markdown-uri-types) ":[^]\t\n\r<>,;() ]+") - "Regular expression for matching inline URIs.") - -(defconst markdown-regex-angle-uri - (concat "\\(<\\)\\(" (regexp-opt markdown-uri-types) ":[^]\t\n\r<>,;()]+\\)\\(>\\)") - "Regular expression for matching inline URIs in angle brackets.") - -(defconst markdown-regex-email - "<\\(\\(\\sw\\|\\s_\\|\\s.\\)+@\\(\\sw\\|\\s_\\|\\s.\\)+\\)>" - "Regular expression for matching inline email addresses.") - -(defconst markdown-regex-link-generic - (concat "\\(?:" markdown-regex-wiki-link - "\\|" markdown-regex-link-inline - "\\|" markdown-regex-link-reference - "\\|" markdown-regex-angle-uri "\\)") - "Regular expression for matching any recognized link.") - -(defconst markdown-regex-block-separator - "\\(\\`\\|\\(\n[ \t]*\n\\)[^\n \t]\\)" - "Regular expression for matching block boundaries.") - -(defconst markdown-regex-math-inline - "\\(^\\|[^\\]\\)\\(\\$\\($\\([^\\$]\\|\\\\.\\)*\\$\\|\\([^\\$]\\|\\\\.\\)*\\)\\$\\)" - "Regular expression for itex $..$ or $$..$$ math mode expressions.") - -(defconst markdown-regex-math-display - "^\\\\\\[\\(.\\|\n\\)*?\\\\\\]$" - "Regular expression for itex \[..\] display mode expressions.") - -(defconst markdown-regex-multimarkdown-metadata - "^\\([[:alpha:]][[:alpha:] _-]*?\\):[ \t]*\\(.*\\)$" - "Regular expression for matching MultiMarkdown metadata.") - -(defconst markdown-regex-pandoc-metadata - "^\\(%\\)[ \t]*\\(.*\\)$" - "Regular expression for matching Pandoc metadata.") - -(defvar markdown-mode-font-lock-keywords-basic - (list - (cons 'markdown-match-pre-blocks '((0 markdown-pre-face))) - (cons 'markdown-match-fenced-code-blocks '((0 markdown-pre-face))) - (cons markdown-regex-blockquote 'markdown-blockquote-face) - (cons markdown-regex-header-1-setext '((1 markdown-header-face-1) - (2 markdown-header-rule-face))) - (cons markdown-regex-header-2-setext '((1 markdown-header-face-2) - (2 markdown-header-rule-face))) - (cons markdown-regex-header-6-atx '((1 markdown-header-delimiter-face) - (2 markdown-header-face-6) - (3 markdown-header-delimiter-face))) - (cons markdown-regex-header-5-atx '((1 markdown-header-delimiter-face) - (2 markdown-header-face-5) - (3 markdown-header-delimiter-face))) - (cons markdown-regex-header-4-atx '((1 markdown-header-delimiter-face) - (2 markdown-header-face-4) - (3 markdown-header-delimiter-face))) - (cons markdown-regex-header-3-atx '((1 markdown-header-delimiter-face) - (2 markdown-header-face-3) - (3 markdown-header-delimiter-face))) - (cons markdown-regex-header-2-atx '((1 markdown-header-delimiter-face) - (2 markdown-header-face-2) - (3 markdown-header-delimiter-face))) - (cons markdown-regex-header-1-atx '((1 markdown-header-delimiter-face) - (2 markdown-header-face-1) - (3 markdown-header-delimiter-face))) - (cons 'markdown-match-multimarkdown-metadata '((1 markdown-metadata-key-face) - (2 markdown-metadata-value-face))) - (cons 'markdown-match-pandoc-metadata '((1 markdown-comment-face) - (2 markdown-metadata-value-face))) - (cons markdown-regex-hr 'markdown-header-face) - (cons 'markdown-match-comments '((0 markdown-comment-face))) - (cons 'markdown-match-code '((0 markdown-inline-code-face))) - (cons markdown-regex-angle-uri 'markdown-link-face) - (cons markdown-regex-uri 'markdown-link-face) - (cons markdown-regex-email 'markdown-link-face) - (cons markdown-regex-list '(2 markdown-list-face)) - (cons markdown-regex-footnote 'markdown-footnote-face) - (cons markdown-regex-link-inline '((1 markdown-link-face t t) - (2 markdown-link-face t) - (4 markdown-url-face t) - (6 markdown-link-title-face t t))) - (cons markdown-regex-link-reference '((1 markdown-link-face t t) - (2 markdown-link-face t) - (4 markdown-reference-face t))) - (cons markdown-regex-reference-definition '((1 markdown-reference-face t) - (2 markdown-url-face t) - (3 markdown-link-title-face t))) - (cons markdown-regex-bold '(2 markdown-bold-face)) - (cons markdown-regex-line-break '(1 markdown-line-break-face prepend)) - ) - "Syntax highlighting for Markdown files.") - -(defvar markdown-mode-font-lock-keywords-core - (list - (cons markdown-regex-italic '(2 markdown-italic-face)) - ) - "Additional syntax highlighting for Markdown files. -Includes features which are overridden by some variants.") - -(defconst markdown-mode-font-lock-keywords-math - (list - ;; Math mode $..$ or $$..$$ - (cons markdown-regex-math-inline '(2 markdown-math-face)) - ;; Display mode equations with brackets: \[ \] - (cons markdown-regex-math-display 'markdown-math-face) - ;; Equation reference (eq:foo) - (cons "(eq:[[:alnum:]:_]+)" 'markdown-reference-face) - ;; Equation reference \eqref{foo} - (cons "\\\\eqref{[[:alnum:]:_]+}" 'markdown-reference-face)) - "Syntax highlighting for LaTeX and itex fragments.") - -(defvar markdown-mode-font-lock-keywords nil - "Default highlighting expressions for Markdown mode. -This variable is defined as a buffer-local variable for dynamic -extension support.") - -;; Footnotes -(defvar markdown-footnote-counter 0 - "Counter for footnote numbers.") -(make-variable-buffer-local 'markdown-footnote-counter) - -(defconst markdown-footnote-chars - "[[:alnum:]-]" - "Regular expression maching any character that is allowed in a footnote identifier.") - - -;;; Compatibility ============================================================= - -(defun markdown-replace-regexp-in-string (regexp rep string) - "Replace ocurrences of REGEXP with REP in STRING. -This is a compatibility wrapper to provide `replace-regexp-in-string' -in XEmacs 21." - (if (featurep 'xemacs) - (replace-in-string string regexp rep) - (replace-regexp-in-string regexp rep string))) - -;; `markdown-use-region-p' is a compatibility function which checks -;; for an active region, with fallbacks for older Emacsen and XEmacs. -(eval-and-compile - (cond - ;; Emacs 23 and newer - ((fboundp 'use-region-p) - (defalias 'markdown-use-region-p 'use-region-p)) - ;; Older Emacsen - ((and (boundp 'transient-mark-mode) (boundp 'mark-active)) - (defun markdown-use-region-p () - "Compatibility wrapper to provide `use-region-p'." - (and transient-mark-mode mark-active))) - ;; XEmacs - ((fboundp 'region-active-p) - (defalias 'markdown-use-region-p 'region-active-p)))) - -(defun markdown-use-buttons-p () - "Determine whether this Emacs supports buttons." - (or (featurep 'button) (locate-library "button"))) - - -;;; Markdown Parsing Functions ================================================ - -(defun markdown-cur-line-blank-p () - "Return t if the current line is blank and nil otherwise." - (save-excursion - (beginning-of-line) - (re-search-forward "^\\s *$" (line-end-position) t))) - -(defun markdown-prev-line-blank-p () - "Return t if the previous line is blank and nil otherwise. -If we are at the first line, then consider the previous line to be blank." - (or (= (line-beginning-position) (point-min)) - (save-excursion - (forward-line -1) - (markdown-cur-line-blank-p)))) - -(defun markdown-next-line-blank-p () - "Return t if the next line is blank and nil otherwise. -If we are at the last line, then consider the next line to be blank." - (or (= (line-end-position) (point-max)) - (save-excursion - (forward-line 1) - (markdown-cur-line-blank-p)))) - -(defun markdown-prev-line-indent-p () - "Return t if the previous line is indented and nil otherwise." - (save-excursion - (forward-line -1) - (goto-char (line-beginning-position)) - (if (re-search-forward "^\\s " (line-end-position) t) t))) - -(defun markdown-cur-line-indent () - "Return the number of leading whitespace characters in the current line." - (save-match-data - (save-excursion - (goto-char (line-beginning-position)) - (re-search-forward "^[ \t]+" (line-end-position) t) - (current-column)))) - -(defun markdown-prev-line-indent () - "Return the number of leading whitespace characters in the previous line." - (save-excursion - (forward-line -1) - (markdown-cur-line-indent))) - -(defun markdown-next-line-indent () - "Return the number of leading whitespace characters in the next line." - (save-excursion - (forward-line 1) - (markdown-cur-line-indent))) - -(defun markdown-cur-non-list-indent () - "Return beginning position of list item text (not including the list marker). -Return nil if the current line is not the beginning of a list item." - (save-match-data - (save-excursion - (beginning-of-line) - (when (re-search-forward markdown-regex-list (line-end-position) t) - (current-column))))) - -(defun markdown-prev-non-list-indent () - "Return position of the first non-list-marker on the previous line." - (save-excursion - (forward-line -1) - (markdown-cur-non-list-indent))) - -(defun markdown-new-baseline-p () - "Determine if the current line begins a new baseline level." - (save-excursion - (beginning-of-line) - (save-match-data - (or (looking-at markdown-regex-header) - (looking-at markdown-regex-hr) - (and (null (markdown-cur-non-list-indent)) - (= (markdown-cur-line-indent) 0) - (markdown-prev-line-blank-p)))))) - -(defun markdown-search-backward-baseline () - "Search backward baseline point with no indentation and not a list item." - (end-of-line) - (let (stop) - (while (not (or stop (bobp))) - (re-search-backward markdown-regex-block-separator nil t) - (when (match-end 2) - (goto-char (match-end 2)) - (cond - ((markdown-new-baseline-p) - (setq stop t)) - ((looking-at markdown-regex-list) - (setq stop nil)) - (t (setq stop t))))))) - -(defun markdown-update-list-levels (marker indent levels) - "Update list levels given list MARKER, block INDENT, and current LEVELS. -Here, MARKER is a string representing the type of list, INDENT is an integer -giving the indentation, in spaces, of the current block, and LEVELS is a -list of the indentation levels of parent list items. When LEVELS is nil, -it means we are at baseline (not inside of a nested list)." - (cond - ;; New list item at baseline. - ((and marker (null levels)) - (setq levels (list indent))) - ;; List item with greater indentation (four or more spaces). - ;; Increase list level. - ((and marker (>= indent (+ (car levels) 4))) - (setq levels (cons indent levels))) - ;; List item with greater or equal indentation (less than four spaces). - ;; Do not increase list level. - ((and marker (>= indent (car levels))) - levels) - ;; Lesser indentation level. - ;; Pop appropriate number of elements off LEVELS list (e.g., lesser - ;; indentation could move back more than one list level). Note - ;; that this block need not be the beginning of list item. - ((< indent (car levels)) - (while (and (> (length levels) 1) - (< indent (+ (cadr levels) 4))) - (setq levels (cdr levels))) - levels) - ;; Otherwise, do nothing. - (t levels))) - -(defun markdown-calculate-list-levels () - "Calculate list levels at point. -Return a list of the form (n1 n2 n3 ...) where n1 is the -indentation of the deepest nested list item in the branch of -the list at the point, n2 is the indentation of the parent -list item, and so on. The depth of the list item is therefore -the length of the returned list. If the point is not at or -immediately after a list item, return nil." - (save-excursion - (let ((first (point)) levels indent pre-regexp) - ;; Find a baseline point with zero list indentation - (markdown-search-backward-baseline) - ;; Search for all list items between baseline and LOC - (while (and (< (point) first) - (re-search-forward markdown-regex-list first t)) - (setq pre-regexp (format "^\\( \\|\t\\)\\{%d\\}" (1+ (length levels)))) - (beginning-of-line) - (cond - ;; Make sure this is not a header or hr - ((markdown-new-baseline-p) (setq levels nil)) - ;; Make sure this is not a line from a pre block - ((looking-at pre-regexp)) - ;; If not, then update levels - (t - (setq indent (markdown-cur-line-indent)) - (setq levels (markdown-update-list-levels (match-string 2) - indent levels)))) - (end-of-line)) - levels))) - -(defun markdown-prev-list-item (level) - "Search backward from point for a list item with indentation LEVEL. -Set point to the beginning of the item, and return point, or nil -upon failure." - (let (bounds indent prev) - (setq prev (point)) - (forward-line -1) - (setq indent (markdown-cur-line-indent)) - (while - (cond - ;; Stop at beginning of buffer - ((bobp) (setq prev nil)) - ;; Continue if current line is blank - ((markdown-cur-line-blank-p) t) - ;; List item - ((and (looking-at markdown-regex-list) - (setq bounds (markdown-cur-list-item-bounds))) - (cond - ;; Continue at item with greater indentation - ((> (nth 3 bounds) level) t) - ;; Stop and return point at item of equal indentation - ((= (nth 3 bounds) level) - (setq prev (point)) - nil) - ;; Stop and return nil at item with lesser indentation - ((< (nth 3 bounds) level) - (setq prev nil) - nil))) - ;; Continue while indentation is the same or greater - ((>= indent level) t) - ;; Stop if current indentation is less than list item - ;; and the next is blank - ((and (< indent level) - (markdown-next-line-blank-p)) - (setq prev nil)) - ;; Stop at a header - ((looking-at markdown-regex-header) (setq prev nil)) - ;; Stop at a horizontal rule - ((looking-at markdown-regex-hr) (setq prev nil)) - ;; Otherwise, continue. - (t t)) - (forward-line -1) - (setq indent (markdown-cur-line-indent))) - prev)) - -(defun markdown-next-list-item (level) - "Search forward from point for the next list item with indentation LEVEL. -Set point to the beginning of the item, and return point, or nil -upon failure." - (let (bounds indent prev next) - (setq next (point)) - (forward-line) - (setq indent (markdown-cur-line-indent)) - (while - (cond - ;; Stop at end of the buffer. - ((eobp) (setq prev nil)) - ;; Continue if the current line is blank - ((markdown-cur-line-blank-p) t) - ;; List item - ((and (looking-at markdown-regex-list) - (setq bounds (markdown-cur-list-item-bounds))) - (cond - ;; Continue at item with greater indentation - ((> (nth 3 bounds) level) t) - ;; Stop and return point at item of equal indentation - ((= (nth 3 bounds) level) - (setq next (point)) - nil) - ;; Stop and return nil at item with lesser indentation - ((< (nth 3 bounds) level) - (setq next nil) - nil))) - ;; Continue while indentation is the same or greater - ((>= indent level) t) - ;; Stop if current indentation is less than list item - ;; and the previous line was blank. - ((and (< indent level) - (markdown-prev-line-blank-p)) - (setq next nil)) - ;; Stop at a header - ((looking-at markdown-regex-header) (setq next nil)) - ;; Stop at a horizontal rule - ((looking-at markdown-regex-hr) (setq next nil)) - ;; Otherwise, continue. - (t t)) - (forward-line) - (setq indent (markdown-cur-line-indent))) - next)) - -(defun markdown-cur-list-item-end (level) - "Move to the end of the current list item with nonlist indentation LEVEL. -If the point is not in a list item, do nothing." - (let (indent) - (forward-line) - (setq indent (markdown-cur-line-indent)) - (while - (cond - ;; Stop at end of the buffer. - ((eobp) nil) - ;; Continue if the current line is blank - ((markdown-cur-line-blank-p) t) - ;; Continue while indentation is the same or greater - ((>= indent level) t) - ;; Stop if current indentation is less than list item - ;; and the previous line was blank. - ((and (< indent level) - (markdown-prev-line-blank-p)) - nil) - ;; Stop at a new list item of the same or lesser indentation - ((looking-at markdown-regex-list) nil) - ;; Stop at a header - ((looking-at markdown-regex-header) nil) - ;; Stop at a horizontal rule - ((looking-at markdown-regex-hr) nil) - ;; Otherwise, continue. - (t t)) - (forward-line) - (setq indent (markdown-cur-line-indent))) - ;; Don't skip over whitespace for empty list items (marker and - ;; whitespace only), just move to end of whitespace. - (if (looking-back (concat markdown-regex-list "\\s-*")) - (goto-char (match-end 3)) - (skip-syntax-backward "-")))) - -(defun markdown-cur-list-item-bounds () - "Return bounds and indentation of the current list item. -Return a list of the form (begin end indent nonlist-indent marker). -If the point is not inside a list item, return nil. -Leave match data intact for `markdown-regex-list'." - (let (cur prev-begin prev-end indent nonlist-indent marker) - ;; Store current location - (setq cur (point)) - ;; Verify that cur is between beginning and end of item - (save-excursion - (end-of-line) - (when (re-search-backward markdown-regex-list nil t) - (setq prev-begin (match-beginning 0)) - (setq indent (length (match-string 1))) - (setq nonlist-indent (length (match-string 0))) - (setq marker (concat (match-string 2) (match-string 3))) - (save-match-data - (markdown-cur-list-item-end nonlist-indent) - (setq prev-end (point))) - (when (and (>= cur prev-begin) - (<= cur prev-end) - nonlist-indent) - (list prev-begin prev-end indent nonlist-indent marker)))))) - -(defun markdown-bounds-of-thing-at-point (thing) - "Call `bounds-of-thing-at-point' for THING with slight modifications. -Does not include trailing newlines when THING is 'line. Handles the -end of buffer case by setting both endpoints equal to the value of -`point-max', since an empty region will trigger empty markup insertion. -Return bounds of form (beg . end) if THING is found, or nil otherwise." - (let* ((bounds (bounds-of-thing-at-point thing)) - (a (car bounds)) - (b (cdr bounds))) - (when bounds - (when (eq thing 'line) - (cond ((and (eobp) (markdown-cur-line-blank-p)) - (setq a b)) - ((char-equal (char-before b) ?\^J) - (setq b (1- b))))) - (cons a b)))) - -(defun markdown-reference-definition (reference) - "Find out whether Markdown REFERENCE is defined. -REFERENCE should include the square brackets, like [this]. -When REFERENCE is defined, return a list of the form (text start end) -containing the definition text itself followed by the start and end -locations of the text. Otherwise, return nil. -Leave match data for `markdown-regex-reference-definition' -intact additional processing." - (let ((reference (downcase reference))) - (save-excursion - (goto-char (point-min)) - (catch 'found - (while (re-search-forward markdown-regex-reference-definition nil t) - (when (string= reference (downcase (match-string-no-properties 1))) - (throw 'found - (list (match-string-no-properties 2) - (match-beginning 2) (match-end 2))))))))) - -(defun markdown-get-defined-references () - "Return a list of all defined reference labels (including square brackets)." - (save-excursion - (goto-char (point-min)) - (let (refs) - (while (re-search-forward markdown-regex-reference-definition nil t) - (let ((target (match-string-no-properties 1))) - (add-to-list 'refs target t))) - refs))) - -(defun markdown-code-at-point-p () - "Return non-nil if the point is at an inline code fragment. -Return nil otherwise. Set match data according to -`markdown-match-code' upon success. -This function searches the block for a code fragment that -contains the point using `markdown-match-code'. We do this -because `thing-at-point-looking-at' does not work reliably with -`markdown-regex-code'." - (interactive) - (save-excursion - (let ((old-point (point)) - (end-of-block (progn (markdown-end-of-block) (point))) - found) - (markdown-beginning-of-block) - (while (and (markdown-match-code end-of-block) - (setq found t) - (< (match-end 0) old-point))) - (and found ; matched something - (<= (match-beginning 0) old-point) ; match contains old-point - (>= (match-end 0) old-point))))) - - -;;; Markdown Font Lock Matching Functions ===================================== - -(defun markdown-match-comments (last) - "Match HTML comments from the point to LAST." - (cond ((search-forward "") - (make-local-variable 'comment-start-skip) - (setq comment-start-skip "