Mercurial > emacs
comparison lisp/newcomment.el @ 43689:5e6a5df9973a
(comment-forward): Use forward-comment to skip
over whitespace (or comments) even when comment-use-syntax is nil.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 04 Mar 2002 01:10:55 +0000 |
parents | be541feb06cc |
children | 8a30d8f66e1a |
comparison
equal
deleted
inserted
replaced
43688:fc341cea1c38 | 43689:5e6a5df9973a |
---|---|
3 ;; Copyright (C) 1999, 2000 Free Software Foundation Inc. | 3 ;; Copyright (C) 1999, 2000 Free Software Foundation Inc. |
4 | 4 |
5 ;; Author: code extracted from Emacs-20's simple.el | 5 ;; Author: code extracted from Emacs-20's simple.el |
6 ;; Maintainer: Stefan Monnier <monnier@cs.yale.edu> | 6 ;; Maintainer: Stefan Monnier <monnier@cs.yale.edu> |
7 ;; Keywords: comment uncomment | 7 ;; Keywords: comment uncomment |
8 ;; Revision: $Id: newcomment.el,v 1.43 2001/12/14 21:53:29 monnier Exp $ | 8 ;; Revision: $Id: newcomment.el,v 1.44 2002/01/13 09:59:39 pj Exp $ |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
387 and can use regexps instead of syntax." | 387 and can use regexps instead of syntax." |
388 (setq n (or n 1)) | 388 (setq n (or n 1)) |
389 (if (< n 0) (error "No comment-backward") | 389 (if (< n 0) (error "No comment-backward") |
390 (if comment-use-syntax (forward-comment n) | 390 (if comment-use-syntax (forward-comment n) |
391 (while (> n 0) | 391 (while (> n 0) |
392 (skip-syntax-forward " ") | |
393 (setq n | 392 (setq n |
394 (if (and (looking-at comment-start-skip) | 393 (if (or (forward-comment 1) |
395 (goto-char (match-end 0)) | 394 (and (looking-at comment-start-skip) |
396 (re-search-forward comment-end-skip nil 'move)) | 395 (goto-char (match-end 0)) |
396 (re-search-forward comment-end-skip nil 'move))) | |
397 (1- n) -1))) | 397 (1- n) -1))) |
398 (= n 0)))) | 398 (= n 0)))) |
399 | 399 |
400 (defun comment-enter-backward () | 400 (defun comment-enter-backward () |
401 "Move from the end of a comment to the end of its content. | 401 "Move from the end of a comment to the end of its content. |