X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/1c5f6018d55ea3c0e5430cde60624e2232d87bec..ab422c4d6899b1442cb6954c1829c1fb656b006c:/lisp/textmodes/text-mode.el diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 51040824b2..d9ff04c9b2 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -1,10 +1,11 @@ ;;; text-mode.el --- text mode, and its idiosyncratic commands -;; Copyright (C) 1985, 1992, 1994, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1992, 1994, 2001-2013 Free Software Foundation, +;; Inc. ;; Maintainer: FSF ;; Keywords: wp +;; Package: emacs ;; This file is part of GNU Emacs. @@ -63,8 +64,7 @@ You can thus get the full benefit of adaptive filling (see the variable `adaptive-fill-mode'). \\{text-mode-map} Turning on Text mode runs the normal hook `text-mode-hook'." - (make-local-variable 'text-mode-variant) - (setq text-mode-variant t) + (set (make-local-variable 'text-mode-variant) t) (set (make-local-variable 'require-final-newline) mode-require-final-newline) (set (make-local-variable 'indent-line-function) 'indent-relative)) @@ -81,18 +81,29 @@ Turning on Paragraph-Indent Text mode runs the normal hooks :abbrev-table nil :syntax-table nil (paragraph-indent-minor-mode)) -(defun paragraph-indent-minor-mode () +(define-minor-mode paragraph-indent-minor-mode "Minor mode for editing text, with leading spaces starting a paragraph. In this mode, you do not need blank lines between paragraphs when the first line of the following paragraph starts with whitespace, as with `paragraph-indent-text-mode'. Turning on Paragraph-Indent minor mode runs the normal hook `paragraph-indent-text-mode-hook'." - (interactive) - (set (make-local-variable 'paragraph-start) - (concat "[ \t\n\f]\\|" paragraph-start)) - (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) - (run-hooks 'paragraph-indent-text-mode-hook)) + :initial-value nil + ;; Change the definition of a paragraph start. + (let ((ps-re "[ \t\n\f]\\|")) + (if (eq t (compare-strings ps-re nil nil + paragraph-start nil (length ps-re))) + (if (not paragraph-indent-minor-mode) + (set (make-local-variable 'paragraph-start) + (substring paragraph-start (length ps-re)))) + (if paragraph-indent-minor-mode + (set (make-local-variable 'paragraph-start) + (concat ps-re paragraph-start))))) + ;; Change the indentation function. + (if paragraph-indent-minor-mode + (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) + (if (eq indent-line-function 'indent-to-left-margin) + (set (make-local-variable 'indent-line-function) 'indent-region)))) (defalias 'indented-text-mode 'text-mode) @@ -181,5 +192,4 @@ The argument NLINES says how many lines to center." (setq nlines (1+ nlines)) (forward-line -1))))) -;; arch-tag: a07ccaad-da13-4d7b-9c61-cd04f5926aab ;;; text-mode.el ends here