Commit graph

47 commits

Author SHA1 Message Date
Charlie Gordon
5039815fdd fix some mode probe issues
* perform generic test on extension in text_mode_probe
* allow mode force in language modes by returning 1 instead of 0 in probe
2014-02-06 00:22:17 +00:00
Charlie Gordon
e2beb7c910 improve C mode
* improve do_c_indent to prevent buffer modification if indentation is correct
* simplify do_c_indent_region accordingly
* added c-newline to remove indentation on blank lines
2014-01-31 14:47:06 +00:00
Charlie Gordon
b953aaf811 improve consistency in buffer variables
* change tab-size to tab-width
* make tab-width a buffer variable
* add fill-column buffer variable
* add set-fill-column on C-x f
* add default-tab-width and default-fill-column global variables
* force indent-tabs-mode in makefile mode
* force tab-width to 8 in shell output buffers
2014-01-21 00:01:20 +00:00
Charlie Gordon
890af446cf simplify colorize_line functions: always pass NUL terminated line
* added ustrstart, ustrstr and ustristr utility functions
* simplified org_mode_colorize
2014-01-20 18:04:00 +00:00
Charlie Gordon
deb6972ca3 better charset handling
* make eb_insert_buffer return the number of bytes inserted
* reset page bits upon charset change
* add eb_delete_nextc: delete one encoded character at offset
* add eb_insert_uchar: insert a unicode character with encoding
* add eb_insert_utf8_buf: insert a utf8 encoded buffer with conversion
* make eb_printf insert utf8 bytes with conversion
* add eb_insert_buffer_convert: copy chars between buffers with charset
  conversion
* handle charset conversion correctly in various places
* insert wide caracters from hex mode
* create most buffers as BF_UTF8 by default
* set kill-buffer charset to that of kill source
* convert charsets when yanking
* handle charsets in search/replace system
2014-01-06 09:40:20 +00:00
Charlie Gordon
c91bd12b8f simplified editing modes
* added colorize_func in ModeDef struct
* removed mode_init functions for most language modes
* other small improvements in mode_probe functions
* no need for get_basename in mode_probe functions
2014-01-05 23:42:54 +00:00
Charlie Gordon
b3a709013a improve mode selection, cleanup
* pass ModeDef pointer to mode_probe functions
* add extensions field to mode structure
* rename ascii mode to binary mode
* rename mode variables and fields to more specific names
2014-01-04 17:26:30 +00:00
Charlie Gordon
ba06d7883e fixed gcc 4.7 warnings about variables set but unused 2013-11-23 19:11:13 +00:00
Charlie Gordon
caf6950145 renamed CMD_ and CMDV to CMD2 and CMD3 for consistency 2008-04-25 10:46:58 +00:00
Charlie Gordon
59ac5b743d recognize more extensions 2008-04-20 14:14:42 +00:00
Charlie Gordon
dc093a1e86 added more c-electric-keys 2008-04-10 20:48:49 +00:00
Charlie Gordon
82ce3587f6 recognize more files: *.hh, #pragma 2008-04-09 16:13:40 +00:00
Charlie Gordon
0f862d64dd pass key to exec_command and call_func
added intrinsic command argument ki for last key pressed
simplified C electric keys: : ; { } invoke the same command c-electric-key
pass actual key to self-insert-command
handle M-d, M-DEL, M-p, M-n in shell mode
2008-04-08 09:25:16 +00:00
Charlie Gordon
7868f2b05c added command find-file-other-window
added module extra.c for commands in full version
added command compare_windows
added command delete_horizontal_space
added command show_date_and_time
moved block navigation and kill commands from clang.c to extras.c
2008-03-31 20:35:31 +00:00
Charlie Gordon
72e59be778 fixed crash bug on forward_block in text mode:
- renamed get_colorized_line() to generic_get_colorized_line
 - added get_non_colorized_line() for uncolored modes
 - renamed EditState::get_colorized_line_func to get_colorized_line
   make this function pointer always non NULL

fixed bug in global-set-key: current bindings could not be overloaded

better tty charset detection and handling:
 - always use utf8 when output is not a tty
 - allow override with -c CHARSET command line option
 - added state variable show-unicode to display non latin1 as \uXXXX
 - added command line argument -c CHARSET (--ttycharset) to specify the
   charset of the tty. tty charset is reported in *messages* buffer at startup
 - display unsupported glyphs as half-width or full-width question mark pairs

improved tty output: use kill_end_of_line escape sequence
2008-03-29 18:06:41 +00:00
Charlie Gordon
4d36e09d10 favor C mode on files starting with C comment 2008-03-28 12:23:53 +00:00
Charlie Gordon
54b6f9c641 added reduce_filename to compute a stripped filename for mode probing
stripping VCS/backup prefixes and suffixes, fixing case.
added Lex (.l .lex) and .C files to C mode
fixed spurious error message at edit_set_mode_file
restored standard behaviour for extension() : return pointer to last extension
2008-03-26 08:03:55 +00:00
Charlie Gordon
cb8abc29fc added primitive Shell-script mode in module script.c
added extensions .idl .json .pcc for c-mode
match perl scripts on #!.*bin/perl.*
added DisplayState.space_width
added do_electric_filename on minibuf_mode / and ~
expand ~ syntax upon completing filename entry in minibuf
enable undo in minibuffer
2008-01-12 09:57:40 +00:00
Charlie Gordon
2681b68040 removed EditBuffer.yank_mark and QEmacsState.mark_yank_region
changed API for GetColorizedLineFunc: offset passed by address,
  updated to start of next line
added check_readonly(EditState *s)
added tentative code for unregistring bindings, cycling modes and charsets
experiment alternate method for region highlighting:
  added EditState.region_style and EditState.curline_style
  added QEmacsState.hilite_region
  added DisplayState.style
  added clear_color to reset style bits in unicode array
  display_char_bidir takes style from DisplayState, code point is bare.
  fixed problem in text_display where line_num was not computed in shell mode
  handle region coloring in text_display (tentative)
display line numbers and hex dump offsets as QE_STYLE_COMMENT
display hex dump as QE_STYLE_FUNCTION
2008-01-09 13:41:40 +00:00
Charlie Gordon
a5eae3ed92 bumped copyrights, some cosmetics 2008-01-08 16:37:54 +00:00
Charlie Gordon
98939ddcac changed API for completion functions:
- use CompleteState struct
- use complete_test for each potential match with simple prefix comparison
added new smart string compare function qe_collate to sort strings in
  lexicographical order but sort numeric portions in numerical order
use qe_collate in popup lists and dired
removed redundant alias "iso8859-2"
added strequal(a,b) as an alias for !strcmp(a,b)
  this function makes string collation with strcmp more explicit
  this even fixed a spurious bug in do_set_emulation
2008-01-08 03:42:53 +00:00
Charlie Gordon
26319c05a7 cosmetics: reformated command definitions 2008-01-04 23:04:11 +00:00
Charlie Gordon
f11cf4a207 eb_scratch takes buffer creation flags
added eb_find_new -> find a buffer by name, create one from flags if not found.
qe_register_cmd_table takes ModeDef* instead of mode name
do_global_set_key -> do_set_key with local/global flag
added local-set-key
reuse *bufed* buffer if one exists
bind increase/decrease-width commands from command definition
cosmetics, comments, remarks
renamed kill buffers from *yank* to *kill-%d*
save QErrorContext in parse_args, load_all_modules:
  improves readability in *messages* buffer
fixed qe_init to fall back from x11 display to terminal session upon failure
2008-01-04 22:24:37 +00:00
Charlie Gordon
a71b9efbb4 renamed do_set_mode -> edit_set_mode
use match_extension in mode probe functions
pass move indicator to do_return, removed do_open_line
renamed do_cmd_set_mode -> do_set_mode for consistency
separated strfind and strcasefind, optimized implementation
published register_input_method
unpublished input_methods
optimized KeyDef structure layout
changed eb_search arguments
used eb_delete_range
comments, remarks
better tests on fread failures
set buffer to read-only upon loading non writable file
do_insert_file tests for failure
  set mark at beginning of inserted block and offset at the end
fixed search for word boundary case
made raw_load_buffer1 return number of bytes read, of -1 on error
2008-01-03 18:31:24 +00:00
Charlie Gordon
4743fa1308 added remove_slash and append_slash path utilities
renamed canonize to canonicalize
added crude support for ~user -> /home/user
added win32 specific stuff in basename
added C-/ as an alias for C-_
some cosmetics, moved code
create files with mode 0644 in raw_save_buffer
untabified, removed redundant spaces
modified code generators to the same effect
2008-01-03 09:51:29 +00:00
Charlie Gordon
c556f52763 renamed set_buffer_name to eb_set_buffer_name
made log buffer more readable with log structure padding trick
renamed set_filename to eb_set_filename
added CmdSig enum and CmdProto union for signature based command dispatcher
changed CmdDef structure, val is now required to be an integer (24 bits)
intrinsic string argument ('S') is now passed as prompt with S{xxx} syntax
changed set-mode functions and do_define_kbd_macro accordingly
added signature in CMD_ and CMDV macros
renamed do_load to do_find_file
2007-12-27 10:04:09 +00:00
Charlie Gordon
538d127573 use qe_isalpha_ and qe_isalnum_ in parser
moved block navigation and kill functions to generic command table
2007-12-26 09:55:35 +00:00
Charlie Gordon
a0ea65c425 pass argument to do_char, do_tab, do_quote (fixes bug in C-u C-q a)
pass closure to quote_key
2007-12-25 07:54:00 +00:00
Charlie Gordon
30cb0c37fb simplified string coloring 2007-12-20 11:52:33 +00:00
Charlie Gordon
fa760147c8 added Perl mode: perl.c
added Makefile mode: makemode.c
added HTML source mode: htmlsrc.c
added more dependencies in Makefile
added styles for HTML source coloring:
    html-comment, html-string, html-script, html-entity, html-tag
no longer rely on \n at end of line in c_colorize_line
2007-12-18 18:07:03 +00:00
Charlie Gordon
bf17e23390 renamed css_isxxx and css_toxxx ctype alternatives to qe_* 2007-12-15 16:44:31 +00:00
Charlie Gordon
ca80563f98 added ssizeof, cosmetics 2007-12-15 16:33:20 +00:00
Charlie Gordon
5768f42cd8 no longer use ctype.h macros and functions
- ctype.h has strong constraints on arguments
- ctype.h implements bogus irrelevant inefficient locale specific behaviour
- use replacement css_xxx functions
- all take int arguments: can be any value, yet only test ASCII subset
- all css_isxxx return true boolean (1 or 0)
- removed utoupper(int) -> css_toupper(int) has same functionality

resolved ffmpeg clash on string functions from cutils.c module
- added #defines to make them local
- renamed some strixxx functions to strxxxx (extended behaviour)
- moved case insensitive stuff to util.c

fixed bug in strtokey: C-M-x combinations were not recognized
improved eb_changecase
fixed C comment parsing in css parser
2007-12-15 16:02:47 +00:00
Charlie Gordon
2d99a278f5 improved colorizer:
- simplified preprocessing directives, handle comments
 - colorize char constants and strings with different styles
 - handle javascript <!-- comments
 - handle numbers
 - better support for cast detection

more code simplifications
use colorizer for do_c_forward_block: should make this command non mode specific
2007-12-15 09:57:21 +00:00
Charlie Gordon
57c3461e0d simplified set_color API, made in inline
improved command parsing, refined argval handling, pass as optional arg
pass command arguments as an array of unions
use correct type in command dispatcher (upto 2 arguments)
merged do_goto_byte, do_goto_line, do_goto_char, extend syntax
fixed kill commands: kills are appended/prepended to kill buffer
added append_next_kill command
added do_kill_line (split from do_kill_region)
added do_kill_word (removed do_delete_word)
added do_kill_paragraph
pass argval to do_backspace and do_delete_char, fix kill behaviour
fixed kill-ring initial state bug
fixed do_yank: set mark and this_cmd_func
fixed do_yank_pop: test last_cmd_func, use eb_delete instead of do_undo
fixed do_yank_pop kill-ring bug
added clamp(int x, int min, int max);
added qs->this_cmd_func so commands can override qs->last_cmd_func
allow KEY_ESC + extended key as command binding
added do_c_forward_block, needs rewrite using colorization code
added do_c_kill_block
added insert-char command (argval repeats instead of forcing char value)
renamed delete-word to kill-word
renamed backward-delete-word to backward-kill-word
added kill-beginning-of-line
2007-12-12 02:51:05 +00:00
Charlie Gordon
0507ffacc3 fixed function key mapping issues in X11 and Wndz
fixed C lang colorizer for some multiline stuff, wide char/strings
use countof() macro
cosmetics
2007-12-10 13:28:07 +00:00
Charlie Gordon
855660ae1f added missing C keywords and types 2007-12-10 11:03:36 +00:00
Charlie Gordon
3695abe5b6 added more Hebrew keymaps
support multiple output for input methods
colorize function calls in C mode
2007-12-09 23:31:38 +00:00
Charlie Gordon
6c65411200 added missing headings, cosmetics 2007-12-03 16:10:38 +00:00
Charlie Gordon
eb3afbb862 renamed do_less_quit() to do_less_exit() for consistency with command name
fixed crash in do_less_exit() when invoking "less-exit" with A-x
fixed c auto-indenter to not move point unless within the indent space
fixed the electric-c mode
2007-01-12 15:06:16 +00:00
Charlie Gordon
494e9f7866 include cflags.mk for extra gcc warnings if present
utf8_encode now returns the number of characters copied,
  simplified code accordingly
made local functions static
tagged unused function arguments
fixed shadowing issues
added support for GCC attributes for unused arguments and format strings
use snprintf() instead of sprintf()
moved scattered declarations to qe.h
removed duplicate declarations in header files
eb_write() payload argument is now const
fixed crash bug: reset trace_buffer upon deletion
improved trace_buffer readability: trace all pseudo tty streams separately
added missing structure initializers
removed buffered string handling from cutils.h
added new buffered string API for statically allocated buffers (should unify)
small improvements in X11 initialization
improved consistency in tty.c (function names...)
  added STDIN and STDOUT streams in QEditScreen to stop using stdin and stdout
  use unlocked stream I/O if available (faster)
  changed and documented terminal setup and exit sequences
  improved charset handling
mode_line functions now return the character count (like snprintf)
2006-12-31 19:34:00 +00:00
Charlie Gordon
c52d77ea70 cosmetics only (spacing, untabify) 2005-05-11 15:12:14 +00:00
Charlie Gordon
6dbffb4024 added '*' in command argument strings for commands that modify buffer contents
changed command definitions accordingly.
added C-x C-g binding for abort
added C-\ binding for call-last-kbd-macro
changed binding for switch-input-method to C-x C-\
added commands:
  not-modified on A-~ (reset buffer modified flag)
  load-file-from-path(file)
  mark-whole-buffer() on C-x h
  count-lines() on C-x l
  what-cursor-position on C-x =
allow key_grabber to quit and unget last key.
added splitpath() to dispatch directory and filename into separate buffers.
make separate functions for show_version and show_usage.
make separate function for parse_command_line.
added command line options:
  --help          -h   display help message and exit
  --no-init-file  -q   do not load config files
  --user          -u   load ~USER/.qe/config instead of your own
  --version       -V   display version information and exit
added -- as a marker for end of command line options.
allow most keys to be transmitted to shell process, including function keys.
improved shell buffer escape sequence parser.
added automatic detection of full screen shell applications and grab all keys
  try mc, Menuconfig, or even qemacs within qemacs !
improved *trace* buffer: do not trace keys when trace buffer is current,
  thus allowing navigation without side-effects
improved Makefile to not make html stuff if disabled
reduced CONFIG_TINY feature set
2005-05-09 09:10:37 +00:00
Charlie Gordon
0a3659b866 added strfind to allow more efficient keyword/extension match in language modes
some cosmetic changes
2005-05-05 14:07:50 +00:00
Charlie Gordon
ce16cf2d1e select C mode on more extensions 2005-05-05 13:44:59 +00:00
Charlie Gordon
90f94c7af3 fixed compilation warnings about signed/unsigned comparisons
fixed compilation warnings about const string literals
some cosmetic fixes
2005-05-05 11:10:26 +00:00
Charlie Gordon
3dd0f5660c Initial revision 2004-05-29 10:17:37 +00:00