OpenBSD CVS

CVS log for src/usr.bin/mg/cmode.c


[BACK] Up to [local] / src / usr.bin / mg

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.22 / (download) - annotate - [select for diffs], Fri Apr 21 13:39:37 2023 UTC (12 months, 4 weeks ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.21: +6 -7 lines
Diff to previous 1.21 (colored)

mg: allow to change the tab width

This makes the tab width customizable per-buffer.  The new function
`set-tab-width' changes it for the current buffer or the default value
for new buffers if called with a prefix argument (or from the startup
file.)

The default tab width is still 8 column.

Together with the newly resurrected no-tab-mode, allows to use mg for a
variety of programming languages and coding styles.

Note that it's not possible to call set-tab-width with auto-execute in
the startup file due to limitations in how auto-execute and the parser
work.

ok tb@

Revision 1.21 / (download) - annotate - [select for diffs], Mon Apr 17 09:49:04 2023 UTC (13 months ago) by op
Branch: MAIN
Changes since 1.20: +3 -11 lines
Diff to previous 1.20 (colored)

resurrect mg' no-tab-mode

It's a mode that makes mg insert spaces up to the next tab stop upon
pressing TAB, along with the various tweaks needed in other places so
for e.g. auto-indent-mode also uses spaces.

This is not just an unifdef NOTAB: even under no-tab-mode mg should
consider literal TAB characters wide up to the next tab stop, while the
hidden code considered hard tabs to be just control character (i.e. ^I)
with width of two columns.  I'm also introducing the helper function
doindent() in utils.c to de-obfuscate the insertion of tabs/spaces until
the given column.

ok tb@

Revision 1.20 / (download) - annotate - [select for diffs], Mon Dec 26 19:16:02 2022 UTC (16 months, 3 weeks ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.19: +4 -4 lines
Diff to previous 1.19 (colored)

spelling fixes; from paul tagliamonte
amendments to his diff are noted on tech

Revision 1.19 / (download) - annotate - [select for diffs], Sat Oct 15 09:54:29 2022 UTC (19 months ago) by op
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

typo in comment: Funtion -> Function

Revision 1.18 / (download) - annotate - [select for diffs], Tue May 24 16:24:31 2022 UTC (23 months, 3 weeks ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.17: +3 -1 lines
Diff to previous 1.17 (colored)

automatically delete trailing whitespaces on RET in c-mode and
auto-indent-mode (only after computing the auto indent.)

tested also by Mikhail (thanks!).  ok tb@

Revision 1.17 / (download) - annotate - [select for diffs], Thu Jul 11 18:20:18 2019 UTC (4 years, 10 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.16: +7 -7 lines
Diff to previous 1.16 (colored)

Allow functions that have 1 or more parameters receive and process
multiple arguments when evaluated in a startup file or via one of the
'eval' commands.

This diff does treat the '(' and ')' chars differently during
evaluation than previously, in-so-far as they are not ignored if they
are at the end or start of a line now. However, even though these
characters are not ignored, this diff should not change the behaviour
of an extant .mg file, with '(' and ')' chars at the end and start of
a line.  This situation is accomodated for in this diff (with limited
testing though).

Revision 1.16 / (download) - annotate - [select for diffs], Sat Sep 26 21:51:58 2015 UTC (8 years, 7 months ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.15: +7 -7 lines
Diff to previous 1.15 (colored)

whitespace

Revision 1.15 / (download) - annotate - [select for diffs], Thu Mar 19 21:48:05 2015 UTC (9 years, 2 months ago) by bcallah
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.14: +5 -5 lines
Diff to previous 1.14 (colored)

More unifdef cleanup:
-UDIRED_XMAPS and -UFUND_XMAPS: you can't build mg the other way.
-DTIOCGWINSZ: you have this if you have term.h
Remove a #define TERMCAP which isn't being used.

Remove defines for NDIRED_XMAPS, NFUND_XMAPS, and IMAPEXT. They are all
defined to be 0 and are only ever used in addition. We don't need to add 0.
Simply lines that were using those defines.
ok florian@

Revision 1.14 / (download) - annotate - [select for diffs], Thu Mar 19 21:22:15 2015 UTC (9 years, 2 months ago) by bcallah
Branch: MAIN
Changes since 1.13: +6 -2 lines
Diff to previous 1.13 (colored)

Clean up the includes in mg.
This does the following:
Moves all POSIX headers from sysdef.h into the individual .c files so that
each file now only includes what it needs. All headers are properly sorted.
Moves the remainder of sysdef.h to other files (mostly def.h) and deletes
sysdef.h now that it's no longer contains anything.
Tweak a comment that references sysdef.h so that it no longer does that.
ok florian@

Revision 1.13 / (download) - annotate - [select for diffs], Mon Mar 16 13:47:48 2015 UTC (9 years, 2 months ago) by bcallah
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

Change the internal name of the newline function to deconflict with a
function of the same name in term.h. This is the first step towards
cleaning up mg's includes. No user-visible changes.
ok florian@

Revision 1.12 / (download) - annotate - [select for diffs], Tue Jan 13 17:02:28 2015 UTC (9 years, 4 months ago) by bcallah
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.11: +1 -7 lines
Diff to previous 1.11 (colored)

Remove a variable that's not really being used.
ok deraadt@ jasper@

Revision 1.11 / (download) - annotate - [select for diffs], Fri Jan 2 11:43:15 2015 UTC (9 years, 4 months ago) by lum
Branch: MAIN
Changes since 1.10: +1 -3 lines
Diff to previous 1.10 (colored)

Remove unused variable.

Revision 1.10 / (download) - annotate - [select for diffs], Sun Nov 16 01:08:36 2014 UTC (9 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.9: +4 -4 lines
Diff to previous 1.9 (colored)

Don't save the return from getindent() if you don't need it; adjust
comments to reflect that

based on a diff from Kamil Rytarowski (n54 (at) gmx.com)

Revision 1.9 / (download) - annotate - [select for diffs], Mon Mar 31 14:26:03 2014 UTC (10 years, 1 month ago) by bcallah
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.8: +1 -3 lines
Diff to previous 1.8 (colored)

Remove a redundant assignment for slashp in findnonblank().
Remove a redundant comment in the same place while here.
Tweaks from lum@
ok florian@ lum@

Revision 1.8 / (download) - annotate - [select for diffs], Fri May 18 02:13:44 2012 UTC (12 years ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

Allow no-tab-mode to compile. From James Turner.

note: no-tab-mode needs more work done before removing the NOTABs.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jan 18 17:35:42 2011 UTC (13 years, 4 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.6: +2 -1 lines
Diff to previous 1.6 (colored)

Add missing prototypes and move dired.c to "extensions" in Makefile.
ok kjell@

Revision 1.6 / (download) - annotate - [select for diffs], Wed Dec 17 10:28:27 2008 UTC (15 years, 5 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

change the name displayed by the c-mode on the mode line to "c",
as other modes do, for consistency and to save a few chars.

written with help from kjell@

ok kjell@

Revision 1.5 / (download) - annotate - [select for diffs], Mon Sep 15 16:13:35 2008 UTC (15 years, 8 months ago) by kjell
Branch: MAIN
Changes since 1.4: +3 -5 lines
Diff to previous 1.4 (colored)

Expose the undo commands as proper mg functions.
This should have no functional change on undo, but it does facilitate
testing undo behavior.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Jun 14 08:39:30 2008 UTC (15 years, 11 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.3: +34 -6 lines
Diff to previous 1.3 (colored)

Add compile (c-C c-P) to the c-mode keymap (export from grep.c)
Also, attempt to make indent an atomic undo operation.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Jun 13 19:10:17 2008 UTC (15 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.2: +17 -2 lines
Diff to previous 1.2 (colored)

phessler noted that c-mode ignored blinking braces.
Add "c-handle-special-brace" which does a blink and indent, rather
than just a selfinsert and indent

Revision 1.2 / (download) - annotate - [select for diffs], Thu Jun 12 21:51:18 2008 UTC (15 years, 11 months ago) by kjell
Branch: MAIN
Changes since 1.1: +202 -43 lines
Diff to previous 1.1 (colored)

c-mode now understands the two most common type of comments
(with appropriate indenting):

/*
 * comment
 */

and

foo();  /* comment */

Whew. A lot of code for a seemingly simple idea.
ok phessler@

Revision 1.1 / (download) - annotate - [select for diffs], Thu Jun 12 01:58:44 2008 UTC (15 years, 11 months ago) by kjell
Branch: MAIN

Introduce a basic c-mode to mg.

The intent of this mode is NOT to copy emacs's monster cc-mode.
It is intended to handle basic KNF-format C, assisting
with indentation (to catch obvious typos), and strip
trailing whitespace. It is NOT enabled unless you ask for it (c-mode).

Basically, tab on start-of-line whitespace acts like tab.
Otherwise, tab indents.

Please try it out and let me know where it falls down.

Feedback Reyk, phessler. "hack in tree" from henning, theo

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.