[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r112861: * lisp/simple.el: Move all t
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r112861: * lisp/simple.el: Move all the prog-mode code to prog-mode.el. |
Date: |
Wed, 05 Jun 2013 14:10:27 -0400 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 112861
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-06-05 14:10:27 -0400
message:
* lisp/simple.el: Move all the prog-mode code to prog-mode.el.
* lisp/progmodes/prog-mode.el: New file.
* lisp/loadup.el:
* src/lisp.mk (lisp): Add prog-mode.el.
added:
lisp/progmodes/prog-mode.el
modified:
lisp/ChangeLog
lisp/loadup.el
lisp/simple.el
src/ChangeLog
src/lisp.mk
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-06-05 17:48:50 +0000
+++ b/lisp/ChangeLog 2013-06-05 18:10:27 +0000
@@ -1,3 +1,9 @@
+2013-06-05 Stefan Monnier <address@hidden>
+
+ * simple.el: Move all the prog-mode code to prog-mode.el.
+ * progmodes/prog-mode.el: New file.
+ * loadup.el: Add prog-mode.el.
+
2013-06-05 Teodor Zlatanov <address@hidden>
* simple.el (prog-prettify-symbols): Add version.
=== modified file 'lisp/loadup.el'
--- a/lisp/loadup.el 2013-05-16 09:58:56 +0000
+++ b/lisp/loadup.el 2013-06-05 18:10:27 +0000
@@ -210,6 +210,7 @@
(load "textmodes/page")
(load "register")
(load "textmodes/paragraphs")
+(load "progmodes/prog-mode")
(load "emacs-lisp/lisp-mode")
(load "textmodes/text-mode")
(load "textmodes/fill")
=== added file 'lisp/progmodes/prog-mode.el'
--- a/lisp/progmodes/prog-mode.el 1970-01-01 00:00:00 +0000
+++ b/lisp/progmodes/prog-mode.el 2013-06-05 18:10:27 +0000
@@ -0,0 +1,113 @@
+;;; prog-mode.el --- Generic major mode for programming -*- lexical-binding:t
-*-
+
+;; Copyright (C) Free Software Foundation, Inc.
+
+;; Maintainer: FSF
+;; Keywords: internal
+;; Package: emacs
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This major mode is mostly intended as a parent of other programming
+;; modes. All major modes for programming languages should derive from this
+;; mode so that users can put generic customization on prog-mode-hook.
+
+;;; Code:
+
+(eval-when-compile (require 'cl-lib))
+
+(defgroup prog-mode nil
+ "Generic programming mode, from which others derive."
+ :group 'languages)
+
+(defvar prog-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map [?\C-\M-q] 'prog-indent-sexp)
+ map)
+ "Keymap used for programming modes.")
+
+(defun prog-indent-sexp (&optional defun)
+ "Indent the expression after point.
+When interactively called with prefix, indent the enclosing defun
+instead."
+ (interactive "P")
+ (save-excursion
+ (when defun
+ (end-of-line)
+ (beginning-of-defun))
+ (let ((start (point))
+ (end (progn (forward-sexp 1) (point))))
+ (indent-region start end nil))))
+
+(defvar prog-prettify-symbols-alist nil)
+
+(defcustom prog-prettify-symbols nil
+ "Whether symbols should be prettified.
+When set to an alist in the form `(STRING . CHARACTER)' it will
+augment the mode's native prettify alist."
+ :type '(choice
+ (const :tag "No thanks" nil)
+ (const :tag "Mode defaults" t)
+ (alist :tag "Mode defaults augmented with your own list"
+ :key-type string :value-type character))
+ :version "24.4")
+
+(defun prog--prettify-font-lock-compose-symbol (alist)
+ "Compose a sequence of ascii chars into a symbol.
+Regexp match data 0 points to the chars."
+ ;; Check that the chars should really be composed into a symbol.
+ (let* ((start (match-beginning 0))
+ (end (match-end 0))
+ (syntaxes (if (eq (char-syntax (char-after start)) ?w)
+ '(?w) '(?. ?\\))))
+ (if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes)
+ (memq (char-syntax (or (char-after end) ?\ )) syntaxes)
+ (nth 8 (syntax-ppss)))
+ ;; No composition for you. Let's actually remove any composition
+ ;; we may have added earlier and which is now incorrect.
+ (remove-text-properties start end '(composition))
+ ;; That's a symbol alright, so add the composition.
+ (compose-region start end (cdr (assoc (match-string 0) alist)))))
+ ;; Return nil because we're not adding any face property.
+ nil)
+
+(defun prog-prettify-font-lock-symbols-keywords ()
+ (when prog-prettify-symbols
+ (let ((alist (append prog-prettify-symbols-alist
+ (if (listp prog-prettify-symbols)
+ prog-prettify-symbols
+ nil))))
+ `((,(regexp-opt (mapcar 'car alist) t)
+ (0 (prog--prettify-font-lock-compose-symbol ',alist)))))))
+
+(defun prog-prettify-install (alist)
+ (setq-local prog-prettify-symbols-alist alist)
+ (let ((keywords (prog-prettify-font-lock-symbols-keywords)))
+ (if keywords (font-lock-add-keywords nil keywords))))
+
+;;;###autoload
+(define-derived-mode prog-mode fundamental-mode "Prog"
+ "Major mode for editing programming language source code."
+ (set (make-local-variable 'require-final-newline) mode-require-final-newline)
+ (set (make-local-variable 'parse-sexp-ignore-comments) t)
+ ;; Any programming language is always written left to right.
+ (setq bidi-paragraph-direction 'left-to-right))
+
+(provide 'prog-mode)
+;; arch-tag: 6f3ded02-6cc9-11d8-b018-000a95e675a6
+;;; prog-mode.el ends here
=== modified file 'lisp/simple.el'
--- a/lisp/simple.el 2013-06-05 17:48:50 +0000
+++ b/lisp/simple.el 2013-06-05 18:10:27 +0000
@@ -372,81 +372,6 @@
"Parent major mode from which special major modes should inherit."
(setq buffer-read-only t))
-;; Major mode meant to be the parent of programming modes.
-
-(defvar prog-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map [?\C-\M-q] 'prog-indent-sexp)
- map)
- "Keymap used for programming modes.")
-
-(defun prog-indent-sexp (&optional defun)
- "Indent the expression after point.
-When interactively called with prefix, indent the enclosing defun
-instead."
- (interactive "P")
- (save-excursion
- (when defun
- (end-of-line)
- (beginning-of-defun))
- (let ((start (point))
- (end (progn (forward-sexp 1) (point))))
- (indent-region start end nil))))
-
-(define-derived-mode prog-mode fundamental-mode "Prog"
- "Major mode for editing programming language source code."
- (set (make-local-variable 'require-final-newline) mode-require-final-newline)
- (set (make-local-variable 'parse-sexp-ignore-comments) t)
- (make-local-variable 'prog-prettify-symbols-alist)
- ;; Any programming language is always written left to right.
- (setq bidi-paragraph-direction 'left-to-right))
-
-(defvar prog-prettify-symbols-alist nil)
-
-(defcustom prog-prettify-symbols nil
- "Whether symbols should be prettified.
-When set to an alist in the form `(STRING . CHARACTER)' it will
-augment the mode's native prettify alist."
- :type '(choice
- (const :tag "No thanks" nil)
- (const :tag "Mode defaults" t)
- (alist :tag "Mode defaults augmented with your own list"
- :key-type string :value-type character))
- :version "24.4"
- :group 'languages)
-
-(defun prog--prettify-font-lock-compose-symbol (alist)
- "Compose a sequence of ascii chars into a symbol.
-Regexp match data 0 points to the chars."
- ;; Check that the chars should really be composed into a symbol.
- (let* ((start (match-beginning 0))
- (end (match-end 0))
- (syntaxes (if (eq (char-syntax (char-after start)) ?w)
- '(?w) '(?. ?\\))))
- (if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes)
- (memq (char-syntax (or (char-after end) ?\ )) syntaxes)
- (nth 8 (syntax-ppss)))
- ;; No composition for you. Let's actually remove any composition
- ;; we may have added earlier and which is now incorrect.
- (remove-text-properties start end '(composition))
- ;; That's a symbol alright, so add the composition.
- (compose-region start end (cdr (assoc (match-string 0) alist)))))
- ;; Return nil because we're not adding any face property.
- nil)
-
-(defun prog-prettify-font-lock-symbols-keywords ()
- (when prog-prettify-symbols
- (let ((alist (append prog-prettify-symbols-alist
- (if (listp prog-prettify-symbols)
- prog-prettify-symbols
- nil))))
- `((,(regexp-opt (mapcar 'car alist) t)
- (0 (prog--prettify-font-lock-compose-symbol ',alist)))))))
-
-(defun prog-prettify-install (alist)
- (setq-local prog-prettify-symbols-alist alist)
- (font-lock-add-keywords nil (prog-prettify-font-lock-symbols-keywords)))
-
;; Making and deleting lines.
(defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard))
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-06-05 17:04:13 +0000
+++ b/src/ChangeLog 2013-06-05 18:10:27 +0000
@@ -1,3 +1,7 @@
+2013-06-05 Stefan Monnier <address@hidden>
+
+ * lisp.mk (lisp): Add prog-mode.el.
+
2013-06-05 Paul Eggert <address@hidden>
Chain glib's SIGCHLD handler from Emacs's (Bug#14474).
=== modified file 'src/lisp.mk'
--- a/src/lisp.mk 2013-01-01 09:11:05 +0000
+++ b/src/lisp.mk 2013-06-05 18:10:27 +0000
@@ -129,6 +129,7 @@
$(lispsource)/textmodes/page.elc \
$(lispsource)/register.elc \
$(lispsource)/textmodes/paragraphs.elc \
+ $(lispsource)/progmodes/prog-mode.elc \
$(lispsource)/emacs-lisp/lisp-mode.elc \
$(lispsource)/textmodes/text-mode.elc \
$(lispsource)/textmodes/fill.elc \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r112861: * lisp/simple.el: Move all the prog-mode code to prog-mode.el.,
Stefan Monnier <=