gedit-plugins r319 - in trunk: . plugins/codecomment
- From: pborelli svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit-plugins r319 - in trunk: . plugins/codecomment
- Date: Fri, 1 Feb 2008 21:31:29 +0000 (GMT)
Author: pborelli
Date: Fri Feb 1 21:31:28 2008
New Revision: 319
URL: http://svn.gnome.org/viewvc/gedit-plugins?rev=319&view=rev
Log:
2008-02-01 Paolo Borelli <pborelli katamail com>
* plugins/codecomment/codecomment.py: for C, prefer block comments
over line comments.
Modified:
trunk/ChangeLog
trunk/plugins/codecomment/codecomment.py
Modified: trunk/plugins/codecomment/codecomment.py
==============================================================================
--- trunk/plugins/codecomment/codecomment.py (original)
+++ trunk/plugins/codecomment/codecomment.py Fri Feb 1 21:31:28 2008
@@ -33,16 +33,36 @@
except:
_ = lambda s: s
-def get_comment_tags(lang):
- start_tag = lang.get_metadata('line-comment-start')
- if start_tag:
- return (start_tag, None)
+# If the language is listed here we prefer block comments over line comments.
+# Maybe this list should be user configurable, but just C comes to my mind...
+block_comment_languages = [
+ 'c',
+]
+
+def get_block_comment_tags(lang):
start_tag = lang.get_metadata('block-comment-start')
end_tag = lang.get_metadata('block-comment-end')
if start_tag and end_tag:
return (start_tag, end_tag)
return (None, None)
+def get_line_comment_tags(lang):
+ start_tag = lang.get_metadata('line-comment-start')
+ if start_tag:
+ return (start_tag, None)
+ return (None, None)
+
+def get_comment_tags(lang):
+ if lang.get_id() in block_comment_languages:
+ (s, e) = get_block_comment_tags(lang)
+ if (s, e) == (None, None):
+ (s, e) = get_line_comment_tags(lang)
+ else:
+ (s, e) = get_line_comment_tags(lang)
+ if (s, e) == (None, None):
+ (s, e) = get_block_comment_tags(lang)
+ return (s, e)
+
def forward_tag(iter, tag):
iter.forward_chars(len(tag))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]