]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-cmds.el
(hi-lock-line-face-buffer, hi-lock-face-buffer)
[gnu-emacs] / lisp / progmodes / cc-cmds.el
index ba1ce001473bc79b2e6d8341e1ba482b3d837f0a..391e8b2cb56fb65bd91a8ed7ac81518ba039ff17 100644 (file)
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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, or (at your option)
-;; any later version.
+;; 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
@@ -27,9 +27,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING.  If not, write to
-;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -2674,7 +2672,7 @@ sentence motion in or near comments and multiline strings."
 ;; set up electric character functions to work with pending-del,
 ;; (a.k.a. delsel) mode.  All symbols get the t value except
 ;; the functions which delete, which gets 'supersede.
-(mapcar
+(mapc
  (function
   (lambda (sym)
     (put sym 'delete-selection t)      ; for delsel (Emacs)
@@ -3148,15 +3146,17 @@ non-nil."
   ;; compiled, e.g. in the menus.
   (c-region-is-active-p))
 
-(defun c-indent-line-or-region ()
-  "When the region is active, indent it syntactically.  Otherwise
-indent the current line syntactically."
-  ;; Emacs has a variable called mark-active, XEmacs uses region-active-p
-  (interactive)
-  (if (c-region-is-active-p)
+(defun c-indent-line-or-region (&optional arg region)
+  "Indent active region, current line, or block starting on this line.
+In Transient Mark mode, when the region is active, reindent the region.
+Othewise, with a prefix argument, rigidly reindent the expression
+starting on the current line.
+Otherwise reindent just the current line."
+  (interactive
+   (list current-prefix-arg (use-region-p)))
+  (if region
       (c-indent-region (region-beginning) (region-end))
-    (c-indent-line)))
-
+    (c-indent-command arg)))
 \f
 ;; for progress reporting
 (defvar c-progress-info nil)
@@ -3942,7 +3942,12 @@ command to conveniently insert and align the necessary backslashes."
                  (save-excursion
                    (goto-char (cdr c-lit-limits))
                    (beginning-of-line)
-                   (and (search-forward-regexp
+                   ;; The following conjunct was added to avoid an
+                   ;; "Invalid search bound (wrong side of point)"
+                   ;; error in the subsequent re-search.  Maybe
+                   ;; another fix would be needed (2007-12-08).
+                   (and (> (- (cdr c-lit-limits) 2) (point))
+                        (search-forward-regexp
                          (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
                          (- (cdr c-lit-limits) 2) t)
                         (not (search-forward-regexp
@@ -4524,5 +4529,5 @@ normally bound to C-o.  See `c-context-line-break' for the details."
 \f
 (cc-provide 'cc-cmds)
 
-;;; arch-tag: bf0611dc-d1f4-449e-9e45-4ec7c6936677
+;; arch-tag: bf0611dc-d1f4-449e-9e45-4ec7c6936677
 ;;; cc-cmds.el ends here