Commit graph

5416 commits

Author SHA1 Message Date
Kurtis Rader
ea3d9c36a5 fix off by one error 2016-04-13 09:00:07 -07:00
Kurtis Rader
706bfa70c1 improve the style.fish script
If there are uncommitted changes use `git-clang-format` to limit the style
fixups to the lines being modified.

Refuse to do a `make style-all` if there are uncommitted changes.

Include a fix for the parsing of `git status` output that was recently
incorporated into the lint.fish script.
2016-04-12 19:57:07 -07:00
Kurtis Rader
8e103c231e fish handling of readlink()
The readlink() function does not null terminate the path it returns.

Remove the OS X code that deals with a path buffer that is too short. For
one thing a loop isn't needed since we're told how big of a buffer
is required if the first _NSGetExecutablePath() call fails. But more
important it is so unlikely that the path will be longer than PATH_MAX
that if it is we should just give up.

Fixes 2931.
2016-04-12 19:03:07 -07:00
Kurtis Rader
9569f51e83 revert inadvertent file inclusion in prior commit
Commit 6431c0de16 was not meant to include
changes to fish.cpp.
2016-04-12 19:01:28 -07:00
Kurtis Rader
6431c0de16 fix bug in lint.fish helper script
I just noticed that depending on the state of your working tree there can be
one or more spaces after the modification token and the file name. If there is
more than one space that causes the `string split` to produce unexpected
output.
2016-04-12 18:32:20 -07:00
Fabian Homborg
85799ee86e Remove the default self-insert binding in vi-default mode
Fixes #2832.
2016-04-12 21:40:14 +02:00
Kurtis Rader
0993141334 retry flakey tests on failure
Fixes #2926
2016-04-11 16:47:46 -07:00
Kurtis Rader
46840ae375 another wcstring to wchar_t * change
In keeping with the change made by @ridiculousfish earlier today modify
the `keyword_description()` function to return a const wchar_t pointer.

Also, simplify the `token_type_description()` function to use the recently
introduced mapping array. This changes the wording of many of the token
type descriptions. However, I can't see this as being a problem since
the original descriptions (e.g., "token_redirection") are no clearer to
someone not acquainted with the implementation.
2016-04-10 19:29:23 -07:00
Kurtis Rader
59f0261dba enhance fish_indent to normalize keywords
Fish keywords can be quoted and split across lines. Prior to this change
`fish_indent` would retain such odd, obfuscated, formatting. This change
results in all keywords being converted to their canonical form.

This required fixing a bug: the keyword member of parse_node_t wasn't being
populated. This hadn't been noticed prior to now because it wasn't used.

Fixes #2921
2016-04-10 18:40:11 -07:00
ridiculousfish
7ad6a90ea2 Change parser_token_types from wcstring to const wchar_t *
Reduces allocations and startup time
2016-04-10 01:11:09 -07:00
Aaron Gyes
574851f092 Fix #2919 by removing the entire block.
This code represents only risk and does nothing useful for anything
that can compile fish.

In C++ situations where __STDC_VERSION__ is unset (as it should be),
fish was assuming we are on < C99 and setting it to __FUNCTION__.

Basically always, __PRETTY_FUNCTION__ ends up reaplaced by __FUNCTION__, this hurt
error message usefulness and richness.

__PRETTY_FUNCTION__: const thing::sub(int)
__FUNCTION__: sub
2016-04-09 12:40:04 -07:00
Jak Wings
2d5eaed745 fix handling of line continuation in keywords
This behavior is more consistent with line continuation in strings other
than keywords.

Fixes #2897
2016-04-08 21:05:46 -07:00
Kurtis Rader
6adc35c636 add missing special-case for ../
When I reviewed the fix for #952 I noted that "../" wasn't handled but in my
haste to merge it forgot to augment the pull-request.
2016-04-08 15:52:10 -07:00
Fabian Homborg
6c5f923a47 Remove non-existing functions in bind docs
At least delete-line was previously a thing, but none of these are still available.

First part of #2914
2016-04-08 16:35:12 +02:00
Fabian Homborg
d7c690b416 Fix "." and ".." paths in cd completions
Previously if a directory called "a" was in $CDPATH, `cd ./a<TAB>` would
complete from there even if it was invalid.
2016-04-08 15:03:49 +02:00
David Adam
8eb9dac4bc CHANGELOG: include release notes for previous releases
[ci skip]
2016-04-08 12:45:43 +08:00
David Adam
2ff3a36675 CHANGELOG: move release_notes.html to a markdown document
[ci skip]
2016-04-08 12:39:15 +08:00
ridiculousfish
e395a0eb69 Migrate PATH-completion logic from complete.cpp to expand.cpp
Prior to this fix, when completing a command that doesn't have a /, we
would prepend each component of PATH and then expand the whole thing. So
any special characters in the PATH would be interpreted when performing
tab completion.

With this fix, we pull the PATH resolution out of complete.cpp and
migrate it to expand.cpp. This unifies nicely with the CDPATH resolution
already in that file. This requires introducing a new expand flag
EXPAND_SPECIAL_FOR_COMMAND, which is analogous to EXPAND_SPECIAL_CD
(which is renamed to EXPAND_SPECIAL_FOR_CD). This flag tells expand to
resolve paths against PATH instead of the working directory.

Fixes #952
2016-04-07 20:15:32 -07:00
Aaron Gyes
36691df6fe Stringify many completions and functions, with --invert stringification.
I believe apm must have been buggy - example output that I found online
showed `tr` was mangling paths with spaces in it. Should be fixed.

Also, use dscl on OS X in __fish_complete_users.fish like
__fish_print_users.fish already does.
2016-04-08 10:49:29 +08:00
Aaron Gyes
790c7f80c7 Implement an --invert/-v for string match, like grep -v.
Only lines that do not match the pattern are shown.
2016-04-08 10:49:29 +08:00
ridiculousfish
155befe90e Complain less about "bogus" PATH entries
When determining the old path, get the existing value in any scope,
not just the set scope. Also only complain about absolute paths:
relative paths are expected to be invalid sometimes.
2016-04-07 15:44:56 -07:00
ridiculousfish
9347630d1e Update Xcode project for latest Xcode 2016-04-07 15:26:39 -07:00
Kurtis Rader
784b438d4a fix git command in lint.fish script 2016-04-07 13:47:51 -07:00
ridiculousfish
d2ae00ca44 Remove a dead function bool_from_env_var 2016-04-07 13:29:50 -07:00
Fabian Homborg
8477126ae4 Correct true-color statement in set_color docs
- OSX Terminal does not support it

- We do some detection
2016-04-07 18:27:34 +02:00
David Adam
9c75546724 Update osx/config.h for removed ifdefs 2016-04-07 11:13:38 +08:00
David Adam
e1e1e558ce pcre2: add maintainer mode and disable by default 2016-04-07 11:07:44 +08:00
David Adam
c37c93fcf6 configure: remove tiny leftover from xsel build 2016-04-07 08:21:13 +08:00
Kurtis Rader
35e282928a clarify documentation for the source command
Make it clear that fish 2.3.0 changed how `$argv` is initialized.
2016-04-06 17:18:06 -07:00
Kurtis Rader
02f18cae0a fix setting of $argv for source w/no args
Fixes #139
2016-04-06 13:04:44 -07:00
Kurtis Rader
4ff8e6e781 change how redirections are formatted
Modify `fish_indent` to emit redirections without a space before the target of
the redirection; e.g., "2>&1" rather than "2>& 1" as the former is clearer to
humans.

Fixes #2899
2016-04-05 19:29:23 -07:00
Kurtis Rader
8e8b5a6481 augment the guide for contributing
Include information about how to deal with lint warnings and suppress
`clang-format` reformatting of blocks of code.

Move information only relevant to developers from the README.md to the
CONTRIBUTING.md document.

Closes #2901
2016-04-05 19:19:57 -07:00
David Adam
200a10e78d Rename "snippets" to "conf" internally, and document them as snippets
Discussed in #2896.
2016-04-06 09:33:09 +08:00
Mark Griffiths
9e93ddc097 Fix a couple of minor issues in string examples
Print correct return code in 2nd example
Remove syntax colouring in \cg

Signed-off-by: Mark Griffiths <mark@thebespokepixel.com>
2016-04-05 10:57:32 -07:00
Kurtis Rader
3435e94994 make the string man page more readable
I didn't notice when I merged commit cb6d5d76c8
by thebespokepixel.com that it removed the explicit wrapping in the `string`
man page. That makes `man string` harder to read so reinstate the explicit
wrapping.
2016-04-04 21:32:03 -07:00
Kurtis Rader
fd1b7ba529 support making fish code match the style guide
This changes implements two new make targets: `style` and `style-all`. These
make it easy to ensure that a change conforms to the project style guides for
C++ and fish code.

Fixes #571
2016-04-04 21:00:43 -07:00
Aaron Gyes
a4642f141f don't try to use st_gen (inode generation) number
Per discussion in pull-request #2891, it's not available on Linux (we just
fill it with zero), and unless run as root on OS X (or other BSD system) it
will be zero. Remove it from file_id_t. Also fix the initialization of the
file_id_t structure.

Fixes #2891
2016-04-04 20:17:05 -07:00
Kurtis Rader
8f33b55ccc remove unused special color "ignore"
Resolve lint warning about unused method "rgb_color_t::ignore()".

Fixes #2893
2016-04-04 16:55:40 -07:00
David Adam
484c1484c9 Customisable extra configuration, completion and function directories
- Add options to the autotools build to set the path for the "vendor"
   or "extra" configuration snippets, functions and completions
   directories.

 - Remove the vendor_completions directory from the Xcode build, as
   these are relocatable and compiling the paths in does not make sense.

This allows packaging tools like Homebrew and Nix to use a common
directory outside of the main prefix for third-party completions, and
to make these available for programmatic discovery through `pkg-config`.

Closes #2113
2016-04-04 15:58:13 -07:00
Mark Griffiths
cb6d5d76c8 update lexicon for latest docs
Closes #2699

Fixes issues with:
* 'string' function synopsis
* Redirection display issues
* Better file & path detection
* Rendering of % & @ chars in both html and man
* @ symbol in tutorial

Improves robustness by implementing an @EOL marker to prevent hold buffer dumping extra chars after the end of an expression.

Added new '{{' and '}}' meta-chars for when you want curly braces in a regexp that was previously tripping up the lexicon.

Improve man/html presentation consistency for
* string
* printf
* prompt_pwd
* type

Use cli-styling for 'practical' examples.

Add <bs> tag for presenting content with preceding backslash.

Signed-off-by: Mark Griffiths <mark@thebespokepixel.com>
2016-04-04 15:23:56 -07:00
Kurtis Rader
47f1a92cc4 fixes for cppcheck lint warnings
Refine the linting behavior.

Fix several of the, mostly trivial, lint errors.
2016-04-04 14:34:28 -07:00
Fabian Homborg
0953590cca cd completion: No description for absolute paths
This also removes the "pushd/popd" dance and only executes the CDPATH
stuff when we need to.
2016-04-04 18:22:48 +02:00
Kurtis Rader
411d573ba9 convert atypical env_universal_common logging
This is a quick and dirty conversion of the atypical, and undocumented,
logging done by env_universal_common.cpp to the usual `debug()` pattern. I
didn't want to drop the messages because they could be useful when
debugging future issues. So I simply converted them to the lowest debug
level using the normal debug() function.

Fixes #2887
2016-04-03 20:23:43 -07:00
Kurtis Rader
9dd6873e58 lint: remove or comment out unused functions
Cppcheck has identified a lot of unused functions. This removes funcs that
are unlikely to ever be used. Others that might be useful for debugging I've
commented out with "#if 0".
2016-04-03 19:02:46 -07:00
Kurtis Rader
3f1fc332e7 remove unused wgetopt() method found by linting 2016-04-02 22:18:31 -07:00
Kurtis Rader
bbf0007c46 remove create_wajig_completions.py script
This script is really old and no longer works correctly. This discussion,
http://comments.gmane.org/gmane.comp.shells.fish.user/4062, from over two
years ago concluded it should be removed.

Resolves #2881
2016-04-01 21:01:54 -07:00
Kurtis Rader
6fa09e6a70 add make targets to lint the code
Fixes #2818
2016-04-01 16:29:06 -07:00
David Adam
4f5d42858c travis: move to clang 3.8 for ASan builds 2016-04-01 08:08:36 +08:00
Laurence McGlashan
83233ccc5a Correction to make rule for fish_version 2016-03-31 15:22:08 -07:00
Jak Wings
6888c3d604 rename make target "user_doc" to "doc"
Fixes #2875
2016-03-31 14:52:34 +08:00