octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #44095] readline configuration - tab autocompl


From: Rik
Subject: [Octave-bug-tracker] [bug #44095] readline configuration - tab autocompletion of paths
Date: Sun, 11 Oct 2015 19:26:40 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)

Follow-up Comment #11, bug #44095 (project octave):

The number of functions that accept a filename and might benefit from this
patch is quite large (84, and I'm sure I missed some).  The list I found is
below.


addpath
audioinfo
audioread
audiowrite
bunzip2
bzip2
canonicalize_file_name
cd
chdir
command_line_path
copyfile
delete
dir
dir_in_loadpath
dlmread
dlmwrite
doc_cache_create
doc_cache_file
edit
exec
exist
fileattrib
file_in_loadpath
file_in_path
fileparts
fileread
fopen
fullfile
gen_doc_cache
genpath
get_help_text_from_file
glob
gunzip
gzip
hgload
hgsave
history_file
imfinfo
importdata
imread
imshow
imwrite
info_file
info_program
is_absolute_filename
isdir
is_rooted_relative_filename
javaaddpath
javarmpath
link
load
ls
lstat
make_absolute_filename
makeinfo_program
mex
mkdir
mkfifo
mkoctfile
movefile
octave_core_file_name
rmdir
rmpath
run
rundemos
runtests
save
saveas
savepath
source
system
tempname
texi_macros_file
textread
tilde_expand
unlink
unpack
untar
unzip
urlread
urlwrite
what
which


I reduced the list using as criteria frequency of usage and interactive
utility.  For example, when renaming files it is often files in the same
directory for which the existing completion mechanism will work.  On the other
hand, when you use 'source' it is precisely because the script does not have a
'.m' extension and isn't necessarily on the path.  The list I used is


  static std::string dirfns[] = {"cd ", "ls ", "dir ", "load ", "save ",
                                 "saveas ", "edit ", "exist ", "run ",
                                 "source ", "addpath "};


I changed is_completing_dirfns() to use pre-computed values and compare()
rather than find().  Together, this achieved a 6.5X speedup which is important
since this function can be called frequently.  If we decide to add more
functions to the list we should probably move from a direct linear search to a
hash lookup.

I've uploaded the latest version of the patch to this bug report.  I did not
commit it to the repository because I am getting two warnings during
compilation.


liboctave/util/cmd-edit.cc: In constructor 'gnu_readline::gnu_readline()':
liboctave/util/cmd-edit.cc:214:18: warning:
'gnu_readline::word_break_function' will be initialized after [-Wreorder]
liboctave/util/cmd-edit.cc:210:18: warning:   'int (*
gnu_readline::previous_event_hook)()' [-Wreorder]
liboctave/util/cmd-edit.cc:237:1: warning:   when initialized here
[-Wreorder]

liboctave/util/oct-rl-edit.c: In function
'octave_rl_set_word_break_function':
liboctave/util/oct-rl-edit.c:340:33: warning: assignment from incompatible
pointer type [enabled by default]


This needs someone who understands Readline better than me to take a look.  I
will say, however, that everything works even with these warnings.


(file #35156)
    _______________________________________________________

Additional Item Attachment:

File name: fixtabcomplete.diff            Size:8 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?44095>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]