Commit graph

754 commits

Author SHA1 Message Date
Charlie Gordon
24fb2ba964 parser: small fixes and comments in simplistic parser 2015-09-14 19:05:53 +00:00
Charlie Gordon
9b433ae687 sessions: implement session saving/restoring
- add qe_save_variables(s, b)
- add use_session_file global variable
- add VarDef::modified flag to detect customized variables
- set modified flag upon variable modifications
- dired: set modified flag when changing in dired variables
- fix BUG in qe_register_variables, did not set set_value handler
  on last VarDef element
- make qe_save_variables() public
- remove do_save_variables(), move save_session() to parser.c
- add eb_puts() and eb_putc() for consistency
- add WF_HIDDEN window flag to temporarily flag windows to be deleted
- add do_hide_window(), do_delete_all_windows() and do_delete_hidden_windows()
- add qe_save_window_layout() to save window layout to session file
- add do_create_window(s, filename, layout) to restore window layout
- add qe_save_macros() to save keyboard macros to session file
- detect keyboard macro redefinitions and avoid duplicates
- add qe_save_open_files() to save list of open files and directories
- pass `all` flag to do_delete_other_windows() to force complete deletion
- add qe_load_session() and do_save_session():
  * qe_load_session() is invoked before parsing the command line if
    use_session_file is set, via the config file or command line option (-s)
  * do_save_session() is invoked just before closing qemacs.  It can also
    be invoked as a command and shows a popup window with the contents of
    the session file produced instead of saving it.
- fix CRASH BUG in command definitions, missing argument specifier caused
  spurious crashes when invoking commands from script files. This affected:
  find-file(), find-file-other-window(), find-alternate-file(), kill-buffer()
  load-file-from-path().
- insert newly created windows in list in top-down left-right order
- update WF_RSEPARATOR flag upon deletion of vertically split window
2015-09-10 00:25:23 +00:00
Charlie Gordon
415907161d clang: small improvement on regex coloring for jsx mode 2015-09-09 23:55:26 +00:00
Charlie Gordon
2df74ac150 haskell: colorize compiler directives 2015-09-01 10:14:30 +00:00
Charlie Gordon
be30361e2d html: force refresh upon mode selection 2015-08-31 08:51:17 +00:00
Charlie Gordon
6d87117bbc dired: set default position in new dired window to first entry 2015-08-30 21:51:49 +00:00
Charlie Gordon
bd10c24ac0 bufed: use buffer flag instead of buffer mode name 2015-08-30 15:31:28 +00:00
Charlie Gordon
545284f68b dired: code cleanup, better layout control
- refactored dired_sort_list() as dired_update_buffer():
  better detection of formating changes and less useless sorting
- make sort-mode, hflag, nflag... remanent and global for all dired buffers
- fix and simplify handling of current entry in dired popleft window.
- compute and display numbers of hidden files and directories
- total byte count only accounts for visible entries
- control dired-hflag with 'H': human readable sizes
- control dired-nflag with 'N': alpha/numeric/hidden uid/gid columns
- use variable setter function for dired-sort-mode and dired-time-format
2015-08-30 15:30:58 +00:00
Charlie Gordon
72f67310fa variables: add value setting handler support
- Allow handler to return error codes VAR_INVALID or VAR_READONLY
- Display explicit error messages
- Add variables.h to generic dependency list in Makefile
2015-08-30 12:03:46 +00:00
Charlie Gordon
81bca980fe cosmetics: untabify, remove trailing spaces 2015-08-30 11:27:12 +00:00
Charlie Gordon
f0aa3a4bd8 cosmetics: untabify, remove trailing spaces 2015-08-27 23:03:39 +00:00
Charlie Gordon
581eef3b5d buffers: fix improbable bugs
- make kill buffers system buffers (not displayed in buffer-list)
- only create *scratch* buffer in qe_kill_buffer() if needed
- prevent crash if killing style, log or kill buffers
- display \n as ^J in minibuf
2015-08-27 22:51:56 +00:00
Charlie Gordon
060f860756 fix more linux compilation warnings 2015-08-27 18:59:56 +00:00
Charlie Gordon
9ab179d048 fix linux compile warnings 2015-08-27 18:52:30 +00:00
Charlie Gordon
9331372a54 modes: upgrade mode selection and handling
- separate buffer and window specific mode data management, new API:
   QEModeData *qe_create_buffer_mode_data(EditBuffer *b, ModeDef *m);
   void *qe_get_buffer_mode_data(EditBuffer *b, ModeDef *m, EditState *e);
   QEModeData *qe_create_window_mode_data(EditState *s, ModeDef *m);
   void *qe_get_window_mode_data(EditState *e, ModeDef *m, int status);
   int qe_free_mode_data(QEModeData *md);
- make a list of buffer specific mode data areas so multiple major modes
  can co-exist in different windows for the same buffer
- add mode.mode_free callback to release buffer specific resources
- remove buffer.close callback
- shell state is now buffer specific shell_mode data
- clean up compress and archive mode
- show more buffer modes in buffer-list
- simplify edit_set_mode(), display error message on failure
2015-08-27 15:31:59 +00:00
Charlie Gordon
f37a58b4a6 search: remember last search flags
- C-s and C-r in incremental search also restores flags from last search
- do_search_string() accepts empty string
2015-08-26 23:13:36 +00:00
Charlie Gordon
03db9d420a modes: simplified mode setting and saving
- get rid of ModeSavedData structures
- save window data upon buffer change and mode setting
- make generic_mode_close() and generic_mode_init() local
- simplify edit_set_mode() and switch_to_buffer()
- reset w.insert, w.hex_mode, w.hex_nibble, w.unihex_mode, w.wrap
  to mode specific default values upon mode change.
- split do_set_next_mode() command into qe_set_next_mode() lower level
  function with an extra status parameter report new mode.
2015-08-26 22:51:24 +00:00
Charlie Gordon
0dd8c31b9e bufed: improve dired display
- use static colors and styles
2015-08-26 01:12:21 +00:00
Charlie Gordon
5396a1850b bufed: improve buffer-list display
- use colors and styles
- abbreviate buffer name if too long
- store buffer pointers as opaque data
2015-08-26 01:07:29 +00:00
Charlie Gordon
f408a15503 buffers: misc improvements
- renamed kill_buffer_noconfirm(b) to qe_kill_buffer(b)
- pass extra argument to do_kill_buffer(b, force)
- add buffer name cache to quicken eb_find()
- always make buffer names unique with simpler naming scheme
- small improvement in new_yank_buffer()
2015-08-26 00:53:23 +00:00
Charlie Gordon
bc874d74b7 buffers: improved tracing function
- add EB_TRACE_COMMAND
- change the format of the *trace* buffer
2015-08-26 00:24:14 +00:00
Charlie Gordon
9014b3de79 buffers: clean up, add data_type_name
- rename raw_buffer_load1() to eb_raw_buffer_load1()
- rename log_reset() to eb_free_log_buffer()
- add buffer.data_type_name to display proper handler on modeline
2015-08-25 16:19:42 +00:00
Charlie Gordon
7b996ac907 buffers: changed find_page() low-level routine
- pass offset separately from page_offset return value.
  This will ease the change of int type to support huge files in 64 bits.
- use the page cache also for offsets beyond the page cache.
2015-08-24 12:59:25 +00:00
Charlie Gordon
315147c81f buffers: fixed crash bug and pathological memory fragmentation
- simplify eb_insert_low_level() and eb_insert_buffer() to avoid
  pathological cases of kill/yank sequences loading to catastrophic
  fragmentation. eg: kill a 1 byte region and yank it 1000 times
- mmapped pages are (temporarily) no longer shared between buffers
2015-08-22 20:49:01 +00:00
Charlie Gordon
c506fbc39f buffers: added extra information on page layout in describe-buffer 2015-08-22 20:37:49 +00:00
Charlie Gordon
dff0947665 search: show search matches, fix bugs
- fix bug with word-match incremental search
- pass max offset to eb_search
- simplify search code, keep separate u32 and flag arrays
- add ISearchState* to EditWindow to display current or last matches
- add style for search matches
2015-08-19 20:33:01 +00:00
Charlie Gordon
91284c13a6 modes: fix bug in probe_mode, buffer was not NUL terminated 2015-08-19 19:54:29 +00:00
Charlie Gordon
bccfbef8a0 window handling, bufed/dired: fixed bugs, simplified code
- make show_popup(b) return the window
- pass an extra window argument to find_window() as a default return value
- add check_buffer(EditBuffer **sp) to validate a buffer pointer
- changed eb_find_window(): find a different window attached to a given buffer
- removed edit_find(), use eb_find_window() instead
- change edit_attach():
  take window before which to move arg window, use NULL to append at the end.
  If qs->active_window is NULL, set it to the first window
- add buffer flags BF_IS_LOG and BF_IS_STYLE
- create style buffers with a meaningful name
- create log buffers with a meaningful name
- add window flag WF_POPLEFT for dired interactive buffers
- no longer create process buffer and find files in dired pop left pane
- remember last buffer upon switch_to_buffer for predict_switch_to_buffer()
- rename do_file1() as extern qe_load_file() and make it return success status
- prevent do_find_file_other_window() from splitting window if too shallow
- fix window fusion algorithm when deleting left pane with split right pane
- prevent delete-other-windows() from minibuf and poups
- use mode structure as signature for bufed-mode, shell-mode
- make list-buffers open an interactive popup window
- toggle full buffer list with '.'
2015-08-19 19:20:57 +00:00
Charlie Gordon
e2fa870ad9 dired: fixed bugs, simplified code
- use mode structure as signature
- pass DiredState to internal functions
- no longer refuse to descend into symlink directories
- improve navigation when focus goes to a dired buffer in preview mode
- no longer make dired buffers system buffers to fix bufed behaviour
- make dired-time-format a global variable
2015-08-19 16:49:04 +00:00
Charlie Gordon
490a858c22 general: sanity checks
- make QECharset const by default, use struct QECharset for mutable references.
- use OWNED attribute to flag unique pointers to allocated memory.
- add typedefs for InputMethod, ISearchState
- use typedef for ModeDef
2015-08-19 16:22:30 +00:00
Charlie Gordon
7ef8195b34 Makefile: added missing search.c source file 2015-08-19 14:30:11 +00:00
Charlie Gordon
3f605392ec htmlsrc: parse hex html entities 2015-08-19 14:27:40 +00:00
Charlie Gordon
8fc273ccc6 libqhtml: parse hex html entities 2015-08-19 14:26:34 +00:00
Charlie Gordon
bac5773927 tty: rearrange code 2015-08-17 18:13:50 +00:00
Charlie Gordon
b8fb3f310e search: split search code from qe.c into new module search.c 2015-08-17 16:56:48 +00:00
Charlie Gordon
1033a348d8 search: another 35% speed improvement on large files
- improve utf8 handling in eb_prevc() using eb_read_one_byte()
- added utf8_is_trailing_byte(b) to standardize testing for this
- improve hex searching by 50% using eb_read_one_byte()
- improve regular searching by 35% by removing extra calls to eb_nextc()
2015-08-16 23:15:01 +00:00
Charlie Gordon
e80cb5a149 search: another 2.5x speed improvement on large files
- simplify eb_read() and eb_write() primitives
- make eb_write() return number of bytes actually written
- add eb_read_byte(buffer, offset) to read a single byte
- simplify eb_nextc() accordingly
2015-08-16 19:22:01 +00:00
Charlie Gordon
4dd09ba89d search: 10x speed improvement on large files
- do_center_window used to be very inefficient when invoked with point
  at a great distance from the current window.  This was slowing down
  successful searches on large files by a factor of 10 or more.
2015-08-16 18:01:06 +00:00
Charlie Gordon
456051b1a2 search: some fixes
- fix case matching cycling with C-c and A-c in incremental search
- use smartcase for search-forward and search-backward
- display status for search-forward and search-backward failures
- eb_search returns -1 upon abort
- make eb_search and search_abort_func private;
2015-08-16 17:52:13 +00:00
Charlie Gordon
504f111229 view-mode: improve navigation
- move cursor instead of scrolling at top of file
- move cursor horizontally except left on bol
- scroll-left anf scroll-right toggle line-wrapping
- change some bindings
  C-down -> forward-paragraph
  C-up   -> backward-paragraph
- fix scroll-left and scroll-right direction argument
- add eb_at_bol(b, offset) primitive
2015-08-16 17:40:40 +00:00
Charlie Gordon
f4001a3610 haskel-mode: add keywords, fix multi-line comment coloring 2015-08-16 17:31:50 +00:00
Charlie Gordon
375187456d clang: improve regex detection in javascript and similar scripts 2015-08-16 17:28:45 +00:00
Charlie Gordon
dd3671e702 complete: do case insensitive matching 2015-08-15 14:18:51 +00:00
Charlie Gordon
5af9d29a2e searching: many improvements
- clean search and replace code
- fix point position upon matches in forward and backward directions
- prevent reverse search from find overlapping matches
- hilite current match
- add style search-match to hilite the current match in incremental-search
  defaults to cyan / magenta
- C-l centers the window
- C-q quotes next character in incremental search
- C-w grabs the word at point
- C-y grabs from point to next end of line
- A-b cycles unihex hex and normal search
- A-w toggles word matching
- A-y yanks last kill in search string
- add same control keys to query-replace command
- fix searching and replacing in hex and unihex modes
- wrap search after failure
- pass search data as u32 buffer
- add eb_insert_u32_buf(b, offset, buf, len) to insert unicode code points
- add window.offset_end -> offset of first char beyond the window
- add qestate.emulation_flags to select between standard emacs behaviour and
  alternate behaviours in internal commands
- fix do_center_cursor() when point is before window start
- add do_center_cursor_maybe() to center window if point is not visible
- allow C-q to quote DEL key (ASCII 127)
2015-08-15 13:08:41 +00:00
Charlie Gordon
65e16f7f82 tty: fixed non ASCII input from utf8 terminals 2015-08-14 15:56:28 +00:00
Charlie Gordon
6c2bef2533 hex-mode: some improvements
- added probe function for binary mode so it gets selected when cycling
  modes with next-mode (bound to M-m)
- renamed w->disp_width as dump_width and make it a window variable
- compute default dump-width more accurately for dired-mode
- dump-width can be controlled with C-left and C-right in
  hex, unihex and binary modes
2015-08-13 23:26:59 +00:00
Charlie Gordon
f84a844a5e tty: improved support for OS/X iterm2
- added support for extended CSI sequences such as
  C-up    = ^[[1;5A
  C-down  = ^[[1;5B
  C-left  = ^[[1;5D
  C-right = ^[[1;5C
  S-left  = ^[[1;2D
  S-right = ^[[1;2C
2015-08-13 23:14:11 +00:00
Charlie Gordon
745972e2fd variables: added VAR_RW_SAVE type for session saving code 2015-08-13 23:00:26 +00:00
Charlie Gordon
b0d01a50ed config script: added new commands
- add eval-expression(expression) on M-:
- add eval-buffer()
- add eval-region()
- add +load <file> command line option to load a script file
- add +eval <expression> command line option to execute commands
  This can be used to benchmark load time:
  time qe `find . -name "*.[ch]"` +eval 'exit_qemacs(0)'
2015-08-11 22:15:38 +00:00
Charlie Gordon
a66cf5a68e minibuffer completion: add fuzzy matching
- add extra group argument in functions add_string() and set_string()
- group matches in completion_sort_func()
- add const char *strmem(const char *str, const void *mem, int size);
- add variable fuzzy-search
- add minibuffer-insert command to handle insert triggers
- display variable status after set-variable
- make TAB a regular char in incremental search
- display control chars as ^x in incremental search prompt
2015-08-11 17:45:30 +00:00