diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000..c540053d5
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,10 @@
+# Use the Google style with these modifications:
+#
+# 1) lines can be up to 100 chars long rather than 80, and
+# 2) use a four space indent rather than two spaces.
+#
+BasedOnStyle: Google
+ColumnLimit: 100
+IndentWidth: 4
+# We don't want OCLint pragmas to be reformatted.
+CommentPragmas: '^!OCLINT'
diff --git a/.gitignore b/.gitignore
index 704ec8d01..4f123aeeb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,16 +21,19 @@ doc_src/commands.hdr
doc_src/index.hdr
po/*.gmo
fish
+fish_key_reader
fish_indent
fish_tests
fish.pc
seq
set_color
+share/__fish_build_paths.fish
share/man/
toc.txt
user_doc/
xcuserdata
test/
+tests/*.tmp.*
FISH-BUILD-VERSION-FILE
version
messages.pot
@@ -38,3 +41,5 @@ lexicon.txt
lexicon_filter
lexicon.log
DerivedData/
+compile_commands.json
+xcodebuild.log
diff --git a/.oclint b/.oclint
new file mode 100644
index 000000000..ad70da646
--- /dev/null
+++ b/.oclint
@@ -0,0 +1,43 @@
+rules:
+rule-configurations:
+ #
+ # This is the default value (as of the time I wrote this) but I'm making
+ # it explicit since it needs to agree with the value used by clang-format.
+ # Thus, if we ever change the fish style to allow longer or shorter lines
+ # this should be changed (as well as the corresponding .clang-format file).
+ #
+ - key: LONG_LINE
+ value: 100
+ #
+ # The default limit for the length of variable names is 20. Long names are
+ # problematic but twenty chars results in way too many errors. So increase
+ # the limit to something more reasonable.
+ #
+ - key: LONG_VARIABLE_NAME
+ value: 30
+
+disable-rules:
+ #
+ # A few instances of "useless parentheses" errors are meaningful. Mostly
+ # in the context of the `return` statement. Unfortunately the vast
+ # majority would result in removing parentheses that decreases
+ # readability. So we're going to ignore this warning and rely on humans to
+ # notice when the parentheses are truly not needed.
+ #
+ # Also, some macro expansions, such as FD_SET(), trigger this warning and
+ # we don't want to suppress each of those individually.
+ #
+ - UselessParentheses
+ #
+ # OCLint wants variable names to be at least three characters in length.
+ # Which would be fine if it supported a reasonable set of exceptions
+ # (e.g., "i", "j", "k") and allowed adding additional exceptions to match
+ # conventions employed by a project. Since it doesn't, and thus generates
+ # a lot of really annoying warnings, we're going to disable this rule.
+ #
+ - ShortVariableName
+ #
+ # This rule flags perfectly reasonable conditions like `if (!some_condition)`
+ # and is therefore just noise. Disable this rule.
+ #
+ - InvertedLogic
diff --git a/.travis.yml b/.travis.yml
index 5dad8d883..16777f0b8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,8 +21,6 @@ matrix:
build_command_prepend: "autoreconf; ./configure; make clean"
build_command: "make -j 4"
branch_pattern: coverity_scan_master
-
-
fast_finish: true
script:
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 000000000..d6a73ba92
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,407 @@
+# fish $nextversion (unreleased)
+
+## Significant changes
+
+- The clipboard integration has been removed in favor of explicit bindings (#3061)
+
+# fish 2.3.0 (released May 20, 2016)
+
+There are no significant changes between 2.3.0 and 2.3b2.
+
+## Other notable fixes and improvements
+
+- `abbr` now allows non-letter keys (#2996).
+- Define a few extra colours on first start (#2987).
+- Multiple documentation updates.
+- Added completions for rmmod (#3007).
+- Improved completions for git (#2998).
+
+## Known issues
+
+- Interactive commands started from fish configuration files or from the `-c` option may, under certain circumstances, be started with incorrect terminal modes and fail to behave as expected. A fix is planned but requires further testing (#2619).
+
+---
+
+# fish 2.3b2 (released May 5, 2016)
+
+## Significant changes
+
+- A new `fish_realpath` builtin and associated function to allow the use of `realpath` even on those platforms that don't ship an appropriate command (#2932).
+- Alt-# toggles the current command line between commented and uncommented states, making it easy to save a command in history without executing it.
+- The `fish_vi_mode` function is now deprecated in favour of `fish_vi_key_bindings`.
+
+## Other notable fixes and improvements
+
+- Fix the build on Cygwin (#2952) and RedHat Enterprise Linux/CentOS 5 (#2955).
+- Avoid confusing the terminal line driver with non-printing characters in `fish_title` (#2453).
+- Improved completions for busctl, git (#2585, #2879, #2984), and netctl.
+
+---
+
+# fish 2.3b1 (released April 19, 2016)
+
+## Significant Changes
+
+- A new `string` builtin to handle... strings! This builtin will measure, split, search and replace text strings, including using regular expressions. It can also be used to turn lists into plain strings using `join`. `string` can be used in place of `sed`, `grep`, `tr`, `cut`, and `awk` in many situations. (#2296)
+- Allow using escape as the Meta modifier key, by waiting after seeing an escape character wait up to 300ms for an additional character. This is consistent with readline (e.g. bash) and can be configured via the `fish_escape_delay_ms variable`. This allows using escape as the Meta modifier. (#1356)
+- Add new directories for vendor functions and configuration snippets (#2500)
+- A new `fish_realpath` builtin and associated `realpath` function should allow scripts to resolve path names via `realpath` regardless of whether there is an external command of that name; albeit with some limitations. See the associated documentation.
+
+## Backward-incompatible changes
+
+- Unmatched globs will now cause an error, except when used with `for`, `set` or `count` (#2719)
+- `and` and `or` will now bind to the closest `if` or `while`, allowing compound conditions without `begin` and `end` (#1428)
+- `set -ql` now searches up to function scope for variables (#2502)
+- `status -f` will now behave the same when run as the main script or using `source` (#2643)
+- `source` no longer puts the file name in `$argv` if no arguments are given (#139)
+- History files are stored under the `XDG_DATA_HOME` hierarchy (by default, in `~/.local/share`), and existing history will be moved on first use (#744)
+
+## Other notable fixes and improvements
+
+- Fish no longer silences errors in config.fish (#2702)
+- Directory autosuggestions will now descend as far as possible if there is only one child directory (#2531)
+- Add support for bright colors (#1464)
+- Allow Ctrl-J (\cj) to be bound separately from Ctrl-M (\cm) (#217)
+- psub now has a "-s"/"–suffix" option to name the temporary file with that suffix
+- Enable 24-bit colors on select terminals (#2495)
+- Support for SVN status in the prompt (#2582)
+- Mercurial and SVN support have been added to the Classic + Git (now Classic + VCS) prompt (via the new \__fish_vcs_prompt function) (#2592)
+- export now handles variables with a "=" in the value (#2403)
+- New completions for:
+ - alsactl
+ - Archlinux's asp, makepkg
+ - Atom's apm (#2390)
+ - entr - the "Event Notify Test Runner" (#2265)
+ - Fedora's dnf (#2638)
+ - OSX diskutil (#2738)
+ - pkgng (#2395)
+ - pulseaudio's pacmd and pactl
+ - rust's rustc and cargo (#2409)
+ - sysctl (#2214)
+ - systemd's machinectl (#2158), busctl (#2144), systemd-nspawn, systemd-analyze, localectl, timedatectl
+ - and more
+- Fish no longer has a function called sgrep, freeing it for user customization (#2245)
+- A rewrite of the completions for cd, fixing a few bugs (#2299, #2300, #562)
+- Linux VTs now run in a simplified mode to avoid issues (#2311)
+- The vi-bindings now inherit from the emacs bindings
+- Fish will also execute `fish_user_key_bindings` when in vi-mode
+- `funced` will now also check $VISUAL (#2268)
+- A new `suspend` function (#2269)
+- Subcommand completion now works better with split /usr (#2141)
+- The command-not-found-handler can now be overridden by defining a function called `__fish_command_not_found_handler` in config.fish (#2332)
+- A few fixes to the Sorin theme
+- PWD shortening in the prompt can now be configured via the `fish_prompt_pwd_dir_length` variable, set to the length per path component (#2473)
+- fish no longer requires `/etc/fish/config.fish` to correctly start, and now ships a skeleton file that only contains some documentation (#2799)
+
+---
+
+# fish 2.2.0 (released July 12, 2015)
+
+### Significant changes ###
+
+ * Abbreviations: the new `abbr` command allows for interactively-expanded abbreviations, allowing quick access to frequently-used commands (#731).
+ * Vi mode: run `fish_vi_mode` to switch fish into the key bindings and prompt familiar to users of the Vi editor (#65).
+ * New inline and interactive pager, which will be familiar to users of zsh (#291).
+ * Underlying architectural changes: the `fishd` universal variable server has been removed as it was a source of many bugs and security problems. Notably, old fish sessions will not be able to communicate universal variable changes with new fish sessions. For best results, restart all running instances of `fish`.
+ * The web-based configuration tool has been redesigned, featuring a prompt theme chooser and other improvements.
+ * New German, Brazilian Portuguese, and Chinese translations.
+
+### Backward-incompatible changes ###
+
+These are kept to a minimum, but either change undocumented features or are too hard to use in their existing forms. These changes may break existing scripts.
+
+ * `commandline` no longer interprets functions "in reverse", instead behaving as expected (#1567).
+ * The previously-undocumented `CMD_DURATION` variable is now set for all commands and contains the execution time of the last command in milliseconds (#1585). It is no longer exported to other commands (#1896).
+ * `if` / `else` conditional statements now return values consistent with the Single Unix Specification, like other shells (#1443).
+ * A new "top-level" local scope has been added, allowing local variables declared on the commandline to be visible to subsequent commands. (#1908)
+
+### Other notable fixes and improvements ###
+
+ * New documentation design (#1662), which requires a Doxygen version 1.8.7 or newer to build.
+ * Fish now defines a default directory for other packages to provide completions. By default this is `/usr/share/fish/vendor-completions.d`; on systems with `pkgconfig` installed this path is discoverable with `pkg-config --variable completionsdir fish`.
+ * A new parser removes many bugs; all existing syntax should keep working.
+ * New `fish_preexec` and `fish_postexec` events are fired before and after job execution respectively (#1549).
+ * Unmatched wildcards no longer prevent a job from running. Wildcards used interactively will still print an error, but the job will proceed and the wildcard will expand to zero arguments (#1482).
+ * The `.` command is deprecated and the `source` command is preferred (#310).
+ * `bind` supports "bind modes", which allows bindings to be set for a particular named mode, to support the implementation of Vi mode.
+ * A new `export` alias, which behaves like other shells (#1833).
+ * `command` has a new `--search` option to print the name of the disk file that would be executed, like other shells' `command -v` (#1540).
+ * `commandline` has a new `--paging-mode` option to support the new pager.
+ * `complete` has a new `--wraps` option, which allows a command to (recursively) inherit the completions of a wrapped command (#393), and `complete -e` now correctly erases completions (#380).
+ * Completions are now generated from manual pages by default on the first run of fish (#997).
+ * `fish_indent` can now produce colorized (`--ansi`) and HTML (`--html`) output (#1827).
+ * `functions --erase` now prevents autoloaded functions from being reloaded in the current session.
+ * `history` has a new `--merge` option, to incorporate history from other sessions into the current session (#825).
+ * `jobs` returns 1 if there are no active jobs (#1484).
+ * `read` has several new options:
+ * `--array` to break input into an array (#1540)
+ * `--null` to break lines on NUL characters rather than newlines (#1694)
+ * `--nchars` to read a specific number of characters (#1616)
+ * `--right-prompt` to display a right-hand-side prompt during interactive read (#1698).
+ * `type` has a new `-q` option to suppress output (#1540 and, like other shells, `type -a` now prints all matches for a command (#261).
+ * Pressing F1 now shows the manual page for the current command (#1063).
+ * `fish_title` functions have access to the arguments of the currently running argument as `$argv[1]` (#1542).
+ * The OS command-not-found handler is used on Arch Linux (#1925), nixOS (#1852), openSUSE and Fedora (#1280).
+ * `Alt`+`.` searches backwards in the token history, mapping to the same behavior as inserting the last argument of the previous command, like other shells (#89).
+ * The `SHLVL` environment variable is incremented correctly (#1634 & #1693).
+ * Added completions for `adb` (#1165 & #1211), `apt` (#2018), `aura` (#1292), `composer` (#1607), `cygport` (#1841), `dropbox` (#1533), `elixir` (#1167), `fossil`, `heroku` (#1790), `iex` (#1167), `kitchen` (#2000), `nix` (#1167), `node`/`npm` (#1566), `opam` (#1615), `setfacl` (#1752), `tmuxinator` (#1863), and `yast2` (#1739).
+ * Improved completions for `brew` (#1090 & #1810), `bundler` (#1779), `cd` (#1135), `emerge` (#1840),`git` (#1680, #1834 & #1951), `man` (#960), `modprobe` (#1124), `pacman` (#1292), `rpm` (#1236), `rsync` (#1872), `scp` (#1145), `ssh` (#1234), `sshfs` (#1268), `systemctl` (#1462, #1950 & #1972), `tmux` (#1853), `vagrant` (#1748), `yum` (#1269), and `zypper` (#1787).
+
+---
+
+# fish 2.1.2 (released Feb 24, 2015)
+
+fish 2.1.2 contains a workaround for a filesystem bug in Mac OS X Yosemite. #1859
+
+Specifically, after installing fish 2.1.1 and then rebooting, "Verify Disk" in Disk Utility will report "Invalid number of hard links." We don't have any reports of data loss or other adverse consequences. fish 2.1.2 avoids triggering the bug, but does not repair an already affected filesystem. To repair the filesystem, you can boot into Recovery Mode and use Repair Disk from Disk Utility. Linux and versions of OS X prior to Yosemite are believed to be unaffected.
+
+There are no other changes in this release.
+
+---
+
+# fish 2.1.1 (released September 26, 2014)
+
+__Important:__ if you are upgrading, stop all running instances of `fishd` as soon as possible after installing this release; it will be restarted automatically. On most systems, there will be no further action required. Note that some environments (where `XDG_RUNTIME_DIR` is set), such as Fedora 20, will require a restart of all running fish processes before universal variables work as intended.
+
+Distributors are highly encouraged to call `killall fishd`, `pkill fishd` or similar in installation scripts, or to warn their users to do so.
+
+### Security fixes
+ * The fish_config web interface now uses an authentication token to protect requests and only responds to requests from the local machine with this token, preventing a remote code execution attack. (closing CVE-2014-2914). #1438
+ * `psub` and `funced` are no longer vulnerable to attacks which allow local privilege escalation and data tampering (closing CVE-2014-2906 and CVE-2014-3856). #1437
+ * `fishd` uses a secure path for its socket, preventing a local privilege escalation attack (closing CVE-2014-2905). #1436
+ * `__fish_print_packages` is no longer vulnerable to attacks which would allow local privilege escalation and data tampering (closing CVE-2014-3219). #1440
+
+### Other fixes
+ * `fishd` now ignores SIGPIPE, fixing crashes using tools like GNU Parallel and which occurred more often as a result of the other `fishd` changes. #1084 & #1690
+
+---
+
+# fish 2.1.0
+
+Significant Changes
+-------------------
+
+* **Tab completions will fuzzy-match files.** #568
+
+ When tab-completing a file, fish will first attempt prefix matches (`foo` matches `foobar`), then substring matches (`ooba` matches `foobar`), and lastly subsequence matches (`fbr` matches `foobar`). For example, in a directory with files foo1.txt, foo2.txt, foo3.txt…, you can type only the numeric part and hit tab to fill in the rest.
+
+ This feature is implemented for files and executables. It is not yet implemented for options (like `--foobar`), and not yet implemented across path components (like `/u/l/b` to match `/usr/local/bin`).
+
+* **Redirections now work better across pipelines.** #110, #877
+
+ In particular, you can pipe stderr and stdout together, for example, with `cmd ^&1 | tee log.txt`, or the more familiar `cmd 2>&1 | tee log.txt`.
+
+* **A single `%` now expands to the last job backgrounded.** #1008
+
+ Previously, a single `%` would pid-expand to either all backgrounded jobs, or all jobs owned by your user. Now it expands to the last job backgrounded. If no job is in the background, it will fail to expand. In particular, `fg %` can be used to put the most recent background job in the foreground.
+
+Other Notable Fixes
+-------------------
+
+* alt-U and alt+C now uppercase and capitalize words, respectively. #995
+
+* VTE based terminals should now know the working directory. #906
+
+* The autotools build now works on Mavericks. #968
+
+* The end-of-line binding (ctrl+E) now accepts autosuggestions. #932
+
+* Directories in `/etc/paths` (used on OS X) are now prepended instead of appended, similar to other shells. #927
+
+* Option-right-arrow (used for partial autosuggestion completion) now works on iTerm2. #920
+
+* Tab completions now work properly within nested subcommands. #913
+
+* `printf` supports \e, the escape character. #910
+
+* `fish_config history` no longer shows duplicate items. #900
+
+* `$fish_user_paths` is now prepended to $PATH instead of appended. #888
+
+* Jobs complete when all processes complete. #876
+
+
+ For example, in previous versions of fish, `sleep 10 | echo Done` returns control immediately, because echo does not read from stdin. Now it does not complete until sleep exits (presumably after 10 seconds).
+
+* Better error reporting for square brackets. #875
+
+* fish no longer tries to add `/bin` to `$PATH` unless PATH is totally empty. #852
+
+* History token substitution (alt-up) now works correctly inside subshells. #833
+
+* Flow control is now disabled, freeing up ctrl-S and ctrl-Q for other uses. #814
+
+* sh-style variable setting like `foo=bar` now produces better error messages. #809
+
+* Commands with wildcards no longer produce autosuggestions. #785
+
+* funced no longer freaks out when supplied with no arguments. #780
+
+* fish.app now works correctly in a directory containing spaces. #774
+
+* Tab completion cycling no longer occasionally fails to repaint. #765
+
+* Comments now work in eval'd strings. #684
+
+* History search (up-arrow) now shows the item matching the autosuggestion, if that autosuggestion was truncated. #650
+
+* Ctrl-T now transposes characters, as in other shells. #128
+
+---
+
+# fish 2.0.0
+
+Significant Changes
+-------------------
+
+* **Command substitutions now modify `$status` #547.**
+ Previously the exit status of command substitutions (like `(pwd)`) was ignored; however now it modifies $status. Furthermore, the `set` command now only sets $status on failure; it is untouched on success. This allows for the following pattern:
+
+ ```sh
+ if set python_path (which python)
+ ...
+ end
+ ```
+ Because set does not modify $status on success, the if branch effectively tests whether `which` succeeded, and if so, whether the `set` also succeeded.
+* **Improvements to $PATH handling.**
+ * There is a new variable, `$fish_user_paths`, which can be set universally, and whose contents are appended to $PATH #527
+ * /etc/paths and /etc/paths.d are now respected on OS X
+ * fish no longer modifies $PATH to find its own binaries
+* **Long lines no longer use ellipsis for line breaks**, and copy and paste
+ should no longer include a newline even if the line was broken #300
+* **New syntax for index ranges** (sometimes known as "slices") #212
+* **fish now supports an `else if` statement** #134
+* **Process and pid completion now works on OS X** #129
+* **fish is now relocatable**, and no longer depends on compiled-in paths #125
+* **fish now supports a right prompt (RPROMPT)** through the fish_right_prompt function #80
+* **fish now uses posix_spawn instead of fork when possible**, which is much faster on BSD and OS X #11
+
+Other Notable Fixes
+-------------------
+
+* Updated VCS completions (darcs, cvs, svn, etc.)
+* Avoid calling getcwd on the main thread, as it can hang #696
+* Control-D (forward delete) no longer stops at a period #667
+* Completions for many new commands
+* fish now respects rxvt's unique keybindings #657
+* xsel is no longer built as part of fish. It will still be invoked if installed separately #633
+* __fish_filter_mime no longer spews #628
+* The --no-execute option to fish no longer falls over when reaching the end of a block #624
+* fish_config knows how to find fish even if it's not in the $PATH #621
+* A leading space now prevents writing to history, as is done in bash and zsh #615
+* Hitting enter after a backslash only goes to a new line if it is followed by whitespace or the end of the line #613
+* printf is now a builtin #611
+* Event handlers should no longer fire if signals are blocked #608
+* set_color is now a builtin #578
+* man page completions are now located in a new generated_completions directory, instead of your completions directory #576
+* tab now clears autosuggestions #561
+* tab completion from within a pair of quotes now attempts to "appropriate" the closing quote #552
+* $EDITOR can now be a list: for example, `set EDITOR gvim -f`) #541
+* `case` bodies are now indented #530
+* The profile switch `-p` no longer crashes #517
+* You can now control-C out of `read` #516
+* `umask` is now functional on OS X #515
+* Avoid calling getpwnam on the main thread, as it can hang #512
+* Alt-F or Alt-right-arrow (Option-F or option-right-arrow) now accepts one word of an autosuggestion #435
+* Setting fish as your login shell no longer kills OpenSUSE #367
+* Backslashes now join lines, instead of creating multiple commands #347
+* echo now implements the -e flag to interpret escapes #337
+* When the last token in the user's input contains capital letters, use its case in preference to that of the autosuggestion #335
+* Descriptions now have their own muted color #279
+* Wildcards beginning with a . (for example, `ls .*`) no longer match . and .. #270
+* Recursive wildcards now handle symlink loops #268
+* You can now delete history items from the fish_config web interface #250
+* The OS X build now weak links `wcsdup` and `wcscasecmp` #240
+* fish now saves and restores the process group, which prevents certain processes from being erroneously reported as stopped #197
+* funced now takes an editor option #187
+* Alternating row colors are available in fish pager through `fish_pager_color_secondary` #186
+* Universal variable values are now stored based on your MAC address, not your hostname #183
+* The caret ^ now only does a stderr redirection if it is the first character of a token, making git users happy #168
+* Autosuggestions will no longer cause line wrapping #167
+* Better handling of Unicode combining characters #155
+* fish SIGHUPs processes more often #138
+* fish no longer causes `sudo` to ask for a password every time
+* fish behaves better under Midnight Commander #121
+* `set -e` no longer crashes #100
+* fish now will automatically import history from bash, if there is no fish history #66
+* Backslashed-newlines inside quoted strings now behave more intuitively #52
+* Tab titles should be shown correctly in iTerm2 #47
+* scp remote path completion now sometimes works #42
+* The `read` builtin no longer shows autosuggestions #29
+* Custom key bindings can now be set via the `fish_user_key_bindings` function #21
+* All Python scripts now run correctly under both Python 2 and Python 3 #14
+* The "accept autosuggestion" key can now be configured #19
+* Autosuggestions will no longer suggest invalid commands #6
+
+---
+
+# fishfish Beta r2
+
+Bug Fixes
+---------
+
+* **Implicit cd** is back, for paths that start with one or two dots, a slash, or a tilde.
+* **Overrides of default functions should be fixed.** The "internalized scripts" feature is disabled for now.
+* **Disabled delayed suspend.** This is a strange job-control feature of BSD systems, including OS X. Disabling it frees up Control Y for other purposes; in particular, for yank, which now works on OS X.
+* **fish_indent is fixed.** In particular, the `funced` and `funcsave` functions work again.
+* A SIGTERM now ends the whole execution stack again (resolving #13).
+* Bumped the __fish_config_interactive version number so the default fish_color_autosuggestion kicks in.
+* fish_config better handles combined term256 and classic colors like "555 yellow".
+
+New Features
+------------
+
+* **A history builtin**, and associated interactive function that enables deleting history items. Example usage:
+ * Print all history items beginning with echo: `history --prefix echo`
+ * Print all history items containing foo: `history --contains foo`
+ * Interactively delete some items containing foo: `history --delete --contains foo`
+
+Credit to @siteshwar for implementation. Thanks @siteshwar!
+
+---
+
+# fishfish Beta r1
+
+## Scripting
+* No changes! All existing fish scripts, config files, completions, etc. from trunk should continue to work.
+
+## New Features
+* **Autosuggestions**. Think URL fields in browsers. When you type a command, fish will suggest the rest of the command after the cursor, in a muted gray when possible. You can accept the suggestion with the right arrow key or Ctrl-F. Suggestions come from command history, completions, and some custom code for cd; there's a lot of potential for improvement here. The suggestions are computed on a background pthread, so they never slow down your typing. The autosuggestion feature is incredible. I miss it dearly every time I use anything else.
+
+* **term256 support** where available, specifically modern xterms and OS X Lion. You can specify colors the old way ('set_color cyan') or by specifying RGB hex values ('set_color FF3333'); fish will pick the closest supported color. Some xterms do not advertise term256 support either in the $TERM or terminfo max_colors field, but nevertheless support it. For that reason, fish will default into using it on any xterm (but it can be disabled with an environment variable).
+
+* **Web-based configuration** page. There is a new function 'fish_config'. This spins up a simple Python web server and opens a browser window to it. From this web page, you can set your shell colors and view your functions, variables, and history; all changes apply immediately to all running shells. Eventually all configuration ought to be supported via this mechanism (but in addition to, not instead of, command line mechanisms).
+
+* **Man page completions**. There is a new function 'fish_update_completions'. This function reads all the man1 files from your manpath, removes the roff formatting, parses them to find the commands and options, and outputs fish completions into ~/.config/fish/completions. It won't overwrite existing completion files (except ones that it generated itself).
+
+## Programmatic Changes
+* fish is now entirely in C++. I have no particular love for C++, but it provides a ready memory-model to replace halloc. We've made an effort to keep it to a sane and portable subset (no C++11, no boost, no going crazy with templates or smart pointers), but we do use the STL and a little tr1.
+* halloc is entirely gone, replaced by normal C++ ownership semantics. If you don't know what halloc is, well, now you have two reasons to be happy.
+* All the crufty C data structures are entirely gone. array_list_t, priority_queue_t, hash_table_t, string_buffer_t have been removed and replaced by STL equivalents like std::vector, std::map, and std::wstring. A lot of the string handling now uses std::wstring instead of wchar_t *
+* fish now spawns pthreads for tasks like syntax highlighting that require blocking I/O.
+* History has been completely rewritten. History files now use an extensible YAML-style syntax. History "merging" (multiple shells writing to the same history file) now works better. There is now a maximum history length of about 250k items (256 * 1024).
+* The parser has been "instanced," so you can now create more than one.
+* Total #LoC has shrunk slightly even with the new features.
+
+## Performance
+* fish now runs syntax highlighting in a background thread, so typing commands is always responsive even on slow filesystems.
+* echo, test, and pwd are now builtins, which eliminates many forks.
+* The files in share/functions and share/completions now get 'internalized' into C strings that get compiled in with fish. This substantially reduces the number of files touched at startup. A consequence is that you cannot change these functions without recompiling, but often other functions depend on these "standard" functions, so changing them is perhaps not a good idea anyways.
+
+Here are some system call counts for launching and then exiting fish with the default configuration, on OS X. The first column is fish trunk, the next column is with our changes, and the last column is bash for comparison. This data was collected via dtrace.
+
+
+ | | before | after | bash
+ |
| open | 9 | 4 | 5
+ |
| fork | 28 | 14 | 0
+ |
| stat | 131 | 85 | 11
+ |
| lstat | 670 | 0 | 0
+ |
| read | 332 | 80 | 4
+ |
| write | 172 | 149 | 0
+ |
+
+The large number of forks relative to bash are due to fish's insanely expensive default prompt, which is unchanged in my version. If we switch to a prompt comparable to bash's (lame) default, the forks drop to 16 with trunk, 4 after our changes.
+
+The large reduction in lstat() numbers is due to fish no longer needing to call ttyname() on OS X.
+
+We've got some work to do to be as lean as bash, but we're on the right track.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d3e2ca1f9..9c93c7234 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,105 +1,245 @@
-# Style guide
-This is style guide for fish contributors. You should use it for any new code
-that you would add to this project and try to format existing code to use this
-style.
+# Guidelines For Developers
-## Formatting
+This document provides guidelines for making changes to the fish-shell project. This includes rules for how to format the code, naming conventions, etc. It also includes recommended best practices such as creating a Travis-CI account so you can verify your changes pass all the tests before making a pull-request.
-1. fish uses the Allman/BSD style of indentation.
-2. Indent with spaces, not tabs.
-3. Use 4 spaces per indent (unless needed like `Makefile`).
-4. Opening curly bracket is on the following line:
+See the bottom of this document for help on installing the linting and style reformatting tools discussed in the following sections.
- // ✔:
- struct name
- {
- // code
- };
+Fish source should limit the C++ features it uses to those available in C++03. That allows fish to use a few components from [C++TR1](https://en.wikipedia.org/wiki/C%2B%2B_Technical_Report_1) such as `shared_ptr`. It also allows fish to be built and run on OS X Snow Leopard (released in 2009); the oldest OS X release we still support.
- void func()
- {
- // code
- }
+## Include What You Use
- if (...)
- {
- // code
- }
+You should not depend on symbols being visible to a `*.cpp` module from `#include` statements inside another header file. In other words if your module does `#include "common.h"` and that header does `#include "signal.h"` your module should pretend that sub-include is not present. It should instead directly `#include "signal.h"` if it needs any symbol from that header. That makes the actual dependencies much clearer. It also makes it easy to modify the headers included by a specific header file without having to worry that will break any module (or header) that includes a particular header.
- // ✗:
- void func() {
- // code
- }
+To help enforce this rule the `make lint` (and `make lint-all`) command will run the [include-what-you-use](http://include-what-you-use.org/) tool. The IWYU you project is on [github](https://github.com/include-what-you-use/include-what-you-use).
-5. Put space after `if`, `while` and `for` before conditions.
+To install the tool on OS X you'll need to add a [formula](https://github.com/jasonmp85/homebrew-iwyu) then install it:
- // ✔:
- if () {}
+```
+brew tap jasonmp85/iwyu
+brew install iwyu
+```
- // ✗:
- if() {}
+On Ubuntu you can install it via `sudo apt-get install iwyu`.
-6. Put spaces before and after operators excluding increment and decrement;
+## Lint Free Code
- // ✔:
- int a = 1 + 2 * 3;
- a++;
+Automated analysis tools like cppcheck and oclint can point out potential bugs. They also help ensure the code has a consistent style and that it avoids patterns that tend to confuse people.
- // ✗:
- int a=1+2*3;
- a ++;
+Ultimately we want lint free code. However, at the moment a lot of cleanup is required to reach that goal. For now simply try to avoid introducing new lint.
-7. Never put spaces between function name and parameters list.
+To make linting the code easy there are two make targets: `lint` and `lint-all`. The latter does just what the name implies. The former will lint any modified but not committed `*.cpp` files. If there is no uncommitted work it will lint the files in the most recent commit.
- // ✔:
- func(args);
+### Dealing With Lint Warnings
- // ✗:
- func (args);
+You are strongly encouraged to address a lint warning by refactoring the code, changing variable names, or whatever action is implied by the warning.
-8. Never put spaces after `(` and before `)`.
-9. Always put space after comma and semicolon.
+### Suppressing Lint Warnings
- // ✔:
- func(arg1, arg2);
+Once in a while the lint tools emit a false positive warning. For example, cppcheck might suggest a memory leak is present when that is not the case. To suppress that cppcheck warning you should insert a line like the following immediately prior to the line cppcheck warned about:
- for (int i = 0; i < LENGTH; i++) {}
+```
+// cppcheck-suppress memleak // addr not really leaked
+```
- // ✗:
- func(arg1,arg2);
+The explanatory portion of the suppression comment is optional. For other types of warnings replace "memleak" with the value inside the parenthesis (e.g., "nullPointerRedundantCheck") from a warning like the following:
- for (int i = 0;i&2
+ exit 1
+ fi
+fi
+exit 0
+```
+
+This will check if the push is to the master branch and, if it is, will run `make test` and only allow the push if that succeeds. In some circumstances it might be advisable to circumvent it with `git push --no-verify`, but usually that should not be necessary.
+
+To install the hook, put it in .git/hooks/pre-push and make it executable.
+
+## Installing the Required Tools
+
+### Installing the Linting Tools
+
+To install the lint checkers on Mac OS X using HomeBrew:
+
+```
+brew tap oclint/formulae
+brew install oclint
+brew install cppcheck
+```
+
+To install the lint checkers on Linux distros that use Apt:
+
+```
+sudo apt-get install clang
+sudo apt-get install oclint
+sudo apt-get install cppcheck
+```
+
+### Installing the Reformatting Tools
+
+To install the reformatting tool on Mac OS X using HomeBrew:
+
+```
+brew install clang-format
+```
+
+To install the reformatting tool on Linux distros that use Apt:
+
+```
+apt-cache search clang-format
+```
+
+That will list the versions available. Pick the newest one available (3.6 for Ubuntu 14.04 as I write this) and install it:
+
+```
+sudo apt-get install clang-format-3.6
+sudo ln -s /usr/bin/clang-format-3.6 /usr/bin/clang-format
+
+```
diff --git a/Doxyfile b/Doxyfile
index d12875a58..cf025f1b1 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -274,6 +274,8 @@ ALIASES += "span{2}=\2"
ALIASES += "spcl{2}=\2"
ALIASES += "bksl{1}=\\\1"
+ALIASES += "pcnt{1}=\%\1"
+ALIASES += "atat{1}=\@"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
diff --git a/Doxyfile.help b/Doxyfile.help
index 979074144..ec4a97c44 100644
--- a/Doxyfile.help
+++ b/Doxyfile.help
@@ -274,6 +274,8 @@ ALIASES += "span{2}=\2"
ALIASES += "spcl{2}=\2"
ALIASES += "bksl{1}=\\\1"
+ALIASES += "pcnt{1}=\%\1"
+ALIASES += "atat{1}=\@"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
diff --git a/Doxyfile.user b/Doxyfile.user
index 96c3bc228..ea2752465 100644
--- a/Doxyfile.user
+++ b/Doxyfile.user
@@ -274,6 +274,8 @@ ALIASES += "span{2}=\2"
ALIASES += "spcl{2}=\2"
ALIASES += "bksl{1}=\\1"
+ALIASES += "pcnt{1}=%\1"
+ALIASES += "atat{1}=@"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
diff --git a/Makefile.in b/Makefile.in
index 056a3d814..4bb0998c1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -23,18 +23,21 @@
# applications, install them, and recalculate dependencies.
#
+#
# This is the default value for SHELL but I like to be explicit about such
# things. Especially in a project like fish where someone might otherwise
# think fish will be used to execute make recipes.
+#
SHELL = /bin/sh
+#
# Used by docdir
+#
PACKAGE_TARNAME = @PACKAGE_TARNAME@
#
# Programs
#
-
CXX := @CXX@
INSTALL:=@INSTALL@
SED := @SED@
@@ -43,7 +46,6 @@ SED := @SED@
#
# Installation directories
#
-
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
@@ -53,13 +55,15 @@ mandir = @mandir@
sysconfdir = @sysconfdir@
docdir = @docdir@
localedir = @localedir@
+extra_completionsdir = @extra_completionsdir@
+extra_functionsdir = @extra_functionsdir@
+extra_confdir = @extra_confdir@
#
# pcre2
#
-
PCRE2_WIDTH = @WCHAR_T_BITS@
-PCRE2_DIR = pcre2-10.20
+PCRE2_DIR = pcre2-10.21
PCRE2_LIBDIR = $(PCRE2_DIR)/.libs
PCRE2_LIB = $(PCRE2_LIBDIR)/libpcre2-$(PCRE2_WIDTH).a
PCRE2_H = $(PCRE2_DIR)/src/pcre2.h
@@ -68,7 +72,6 @@ EXTRA_PCRE2 = @EXTRA_PCRE2@
#
# Various flags
#
-
MACROS = -DLOCALEDIR=\"$(localedir)\" -DPREFIX=L\"$(prefix)\" -DDATADIR=L\"$(datadir)\" -DSYSCONFDIR=L\"$(sysconfdir)\" -DBINDIR=L\"$(bindir)\" -DDOCDIR=L\"$(docdir)\"
CXXFLAGS = @CXXFLAGS@ -iquote. -iquote./src/ $(MACROS) $(EXTRA_CXXFLAGS)
CPPFLAGS = @CPPFLAGS@
@@ -79,55 +82,44 @@ LDFLAGS_FISH = ${LDFLAGS} @LDFLAGS_FISH@
#
# Set to 1 if we have gettext
#
-
HAVE_GETTEXT=@HAVE_GETTEXT@
#
# Set to 1 if we have doxygen
#
-
HAVE_DOXYGEN=@HAVE_DOXYGEN@
#
# All objects that the system needs to build fish, except fish.o
#
+FISH_OBJS := obj/autoload.o obj/builtin.o obj/builtin_commandline.o \
+ obj/builtin_complete.o obj/builtin_jobs.o obj/builtin_printf.o \
+ obj/builtin_set.o obj/builtin_set_color.o obj/builtin_string.o \
+ obj/builtin_test.o obj/builtin_ulimit.o obj/color.o obj/common.o \
+ obj/complete.o obj/env.o obj/env_universal_common.o obj/event.o \
+ obj/exec.o obj/expand.o obj/fallback.o obj/fish_version.o \
+ obj/function.o obj/highlight.o obj/history.o obj/input.o \
+ obj/input_common.o obj/intern.o obj/io.o obj/iothread.o obj/kill.o \
+ obj/output.o obj/pager.o obj/parse_execution.o \
+ obj/parse_productions.o obj/parse_tree.o obj/parse_util.o \
+ obj/parser.o obj/parser_keywords.o obj/path.o obj/postfork.o \
+ obj/proc.o obj/reader.o obj/sanity.o obj/screen.o obj/signal.o \
+ obj/tokenizer.o obj/utf8.o obj/util.o obj/wcstringutil.o \
+ obj/wgetopt.o obj/wildcard.o obj/wutil.o
-FISH_OBJS := obj/function.o obj/builtin.o obj/complete.o obj/env.o obj/exec.o \
- obj/expand.o obj/highlight.o obj/history.o obj/kill.o obj/parser.o \
- obj/proc.o obj/reader.o obj/sanity.o obj/tokenizer.o obj/wildcard.o \
- obj/wgetopt.o obj/wutil.o obj/input.o obj/output.o obj/intern.o \
- obj/env_universal_common.o obj/input_common.o obj/event.o obj/signal.o \
- obj/io.o obj/parse_util.o obj/common.o obj/screen.o obj/path.o \
- obj/autoload.o obj/parser_keywords.o obj/iothread.o obj/color.o \
- obj/postfork.o obj/builtin_string.o obj/builtin_test.o obj/parse_tree.o \
- obj/parse_productions.o obj/parse_execution.o obj/pager.o obj/utf8.o \
- obj/fish_version.o obj/wcstringutil.o
-
-FISH_INDENT_OBJS := obj/fish_indent.o obj/print_help.o $(FISH_OBJS)
-
-#
-# Additional files used by builtin.o
-#
-
-BUILTIN_FILES := src/builtin_set.cpp src/builtin_commandline.cpp \
- src/builtin_ulimit.cpp src/builtin_complete.cpp \
- src/builtin_jobs.cpp src/builtin_set_color.cpp \
- src/builtin_printf.cpp
-
+FISH_INDENT_OBJS := obj/fish_indent.o obj/print_help.o $(FISH_OBJS)
#
# All objects that the system needs to build fish_tests
#
FISH_TESTS_OBJS := $(FISH_OBJS) obj/fish_tests.o
-
#
# All of the sources that produce object files
# (that is, are not themselves #included in other source files)
#
FISH_ALL_OBJS := $(sort $(FISH_OBJS) $(FISH_INDENT_OBJS) $(FISH_TESTS_OBJS) \
- obj/fish.o obj/key_reader.o)
-
+ obj/fish.o obj/fish_key_reader.o)
#
# Files containing user documentation
@@ -137,70 +129,58 @@ FISH_ALL_OBJS := $(sort $(FISH_OBJS) $(FISH_INDENT_OBJS) $(FISH_TESTS_OBJS) \
# These files are the source files, they contain a few @FOO@-style substitutions
# Note that this order defines the order that they appear in the documentation
#
-
-HDR_FILES_SRC := doc_src/index.hdr.in doc_src/tutorial.hdr doc_src/design.hdr doc_src/license.hdr doc_src/commands.hdr.in doc_src/faq.hdr
+HDR_FILES_SRC := doc_src/index.hdr.in doc_src/tutorial.hdr doc_src/design.hdr \
+ doc_src/license.hdr doc_src/commands.hdr.in doc_src/faq.hdr
#
# These are the generated result files
#
-
HDR_FILES := $(HDR_FILES_SRC:.hdr.in=.hdr)
# Use a pattern rule so that Make knows to only issue one invocation
# per http://www.gnu.org/software/make/manual/make.html#Pattern-Intro
-
#
# Files containing documentation for external commands.
#
-
HELP_SRC := $(wildcard doc_src/*.txt)
#
# HTML includes needed for HTML help
#
-
-HTML_SRC := doc_src/user_doc.header.html doc_src/user_doc.footer.html doc_src/user_doc.css
+HTML_SRC := doc_src/user_doc.header.html doc_src/user_doc.footer.html \
+ doc_src/user_doc.css
#
# Files in the test directory
#
-
TEST_IN := $(wildcard tests/test*.in)
#
# Files in ./share/completions/
#
-
COMPLETIONS_DIR_FILES := $(wildcard share/completions/*.fish) share/completions/..fish
-
#
# Files in ./share/functions/
#
-
FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
-
#
# Programs to install
#
-
-PROGRAMS := fish fish_indent
+PROGRAMS := fish fish_indent fish_key_reader
#
# Manual pages to install
#
-
MANUALS := $(addsuffix .1, $(addprefix share/man/man1/, \
$(PROGRAMS)))
-
#
# All translation message catalogs
#
-
TRANSLATIONS_SRC := $(wildcard po/*.po)
ifdef HAVE_GETTEXT
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
@@ -211,9 +191,8 @@ endif
#
# If Doxygen is not available, don't attempt to build the documentation
#
-
ifeq ($(HAVE_DOXYGEN), 1)
- user_doc=user_doc
+ user_doc=doc
share_man=share/man
else
user_doc=
@@ -223,8 +202,7 @@ endif
#
# Make everything needed for installing fish
#
-
-all: $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) fish.pc
+all: $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) fish.pc share/__fish_build_paths.fish
@echo fish has now been built.
@echo Use \'$(MAKE) install\' to install fish.
.PHONY: all
@@ -232,32 +210,27 @@ all: $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) fish.pc
#
# Pull version information
#
-
FISH-BUILD-VERSION-FILE: FORCE
@./build_tools/git_version_gen.sh
-include FISH-BUILD-VERSION-FILE
CXXFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\"
.PHONY: FORCE
-fish_version.o: FISH-BUILD-VERSION-FILE
-
+obj/fish_version.o: FISH-BUILD-VERSION-FILE
#
# These dependencies make sure that autoconf and configure are run
# when the source code for the build configuration has changed.
#
-
configure: configure.ac
./config.status --recheck
Makefile: Makefile.in configure
./config.status
-
#
# Build fish with some debug flags specified. This is GCC specific,
# and should only be used when debuging fish.
#
-
prof: EXTRA_CXXFLAGS += -pg
prof: LDFLAGS += -pg
prof: all
@@ -266,39 +239,35 @@ prof: all
#
# User documentation, describing the features of the fish shell.
#
-
-# Depend on the sources (*.hdr.in) and manually make the
-# intermediate *.hdr and doc.h files if needed
-# The sed command deletes everything including and after the first -, for simpler version numbers
-# Cleans up the user_doc/html directory once Doxygen is done.
-
-user_doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FILES) lexicon_filter
+# Depend on the sources (*.hdr.in) and manually make the intermediate *.hdr
+# and doc.h files if needed. The sed command deletes everything including and
+# after the first -, for simpler version numbers. Cleans up the user_doc/html
+# directory once Doxygen is done.
+#
+doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h \
+ $(HDR_FILES) lexicon_filter
(cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; \
- echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | $(SED) "s/-.*//") | doxygen - && touch user_doc; \
- cd user_doc/html && rm -f bc_s.png bdwn.png closed.png ftv2*.png nav*.png open.png sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html
-
-#
-# Source code documentation. Also includes user documentation.
-#
-
-doc: src/*.h src/*.cpp doc.h Doxyfile lexicon_filter
- (cat Doxyfile; echo INPUT_FILTER=./lexicon_filter; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - ;
-
+ echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | $(SED) "s/-.*//") | \
+ doxygen - && touch user_doc; \
+ cd user_doc/html && rm -f arrow*.png bc_s.png bdwn.png closed.png \
+ doc.png folder*.png ftv2*.png nav*.png open.png splitbar.png \
+ sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html
#
# PDF version of the source code documentation.
#
-
doc/refman.pdf: doc
cd doc/latex && \
make && \
mv refman.pdf ..;
rm -r doc/latex;
+#
# Prep the environment for running the unit tests. When specifying DESTDIR on
# the command line (e.g., `make DESTDIR=/usr/local/`) you must have previously
# installed fish using the same prefix; e.g., `./configure --prefix=/usr/local`
# followed by `make install`.
+#
test-prep:
rm -rf test
mkdir test test/data test/home test/temp
@@ -309,10 +278,12 @@ else
endif
.PHONY: test-prep
+#
# The test target runs both the low level code tests and the high level script
# tests.
#
# Note that doing `make DESTDIR=/some/path/ test` overrides this assignment.
+#
test: DESTDIR = $(PWD)/test/root/
test: prefix = .
test: test-prep install-force test_low_level test_high_level
@@ -320,13 +291,16 @@ test: test-prep install-force test_low_level test_high_level
@rm -rf /tmp/is_potential_path_test
.PHONY: test
+#
# We want the various tests to run serially so their output doesn't mix
# We can do that by adding ordering dependencies based on what goals are being used.
-
+#
test_goals := test_low_level test_fishscript test_interactive
+#
# The following variables define targets that depend on the tests. If any more targets
# are added that depend, directly or indirectly, on tests, they need to be recorded here.
+#
test_test_deps = test_low_level $(test_high_level_test_deps)
test_high_level_test_deps = test_fishscript test_interactive
@@ -352,7 +326,6 @@ test_interactive: $(call filter_up_to,test_interactive,$(active_test_goals))
# commands.hdr collects documentation on all commands, functions and
# builtins
#
-
doc_src/commands.hdr:$(HELP_SRC) doc_src/commands.hdr.in
-rm command_list.tmp command_list_toc.tmp $@
for i in `printf "%s\n" $(HELP_SRC)|sort`; do \
@@ -368,7 +341,6 @@ doc_src/commands.hdr:$(HELP_SRC) doc_src/commands.hdr.in
mv command_list_toc.tmp command_list_toc.txt
cat $@.in | awk '{if ($$0 ~ /@command_list_toc@/) { system("cat command_list_toc.txt"); } else if ($$0 ~ /@command_list@/){ system("cat command_list.txt");} else{ print $$0;}}' >$@
-
toc.txt: $(HDR_FILES:index.hdr=index.hdr.in)
-rm toc.tmp $@
# Ugly hack to set the toc initial title for the main page
@@ -397,7 +369,6 @@ doc_src/index.hdr: toc.txt doc_src/index.hdr.in
# colour defaults from __fish_config_interactive to set the docs colours when
# used in a 'cli' style context.
#
-
lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) share/functions/__fish_config_interactive.fish
-rm lexicon.tmp lexicon_catalog.tmp lexicon_catalog.txt $@
# Scan sources for commands/functions/binaries/colours. If GNU sed was portable, this could be much smarter.
@@ -428,7 +399,6 @@ lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES
# HTML, a style context can be applied through the /fish{style} block and
# providing suitable CSS in user_doc.css.in
#
-
lexicon_filter: lexicon.txt lexicon_filter.in
-rm $@.tmp $@
# Set the shebang as sed can reside in multiple places.
@@ -450,7 +420,6 @@ lexicon_filter: lexicon.txt lexicon_filter.in
# file that can be parsed by Doxygen to generate the user
# documentation.
#
-
doc.h: $(HDR_FILES)
cat $(HDR_FILES) >$@
@@ -460,19 +429,23 @@ doc.h: $(HDR_FILES)
# internal help functions, that can be parsed to Doxygen to generate
# the internal help function text.
#
-
%.doxygen:%.txt
echo "/** \page " `basename $*` >$@;
cat $*.txt >>$@;
echo "*/" >>$@
+#
# Depend on Makefile because I don't see a better way of rebuilding
# if any of the paths change.
+#
%: %.in Makefile FISH-BUILD-VERSION-FILE
$(SED) <$< >$@ \
-e "s,@sysconfdir\@,$(sysconfdir),g" \
-e "s,@datadir\@,$(datadir),g" \
-e "s,@docdir\@,$(docdir),g" \
+ -e "s,@extra_completionsdir\@,$(extra_completionsdir),g" \
+ -e "s,@extra_functionsdir\@,$(extra_functionsdir),g" \
+ -e "s,@extra_confdir\@,$(extra_confdir),g" \
-e "s|@configure_input\@|$@, generated from $@.in by the Makefile. DO NOT MANUALLY EDIT THIS FILE!|g" \
-e "s,@prefix\@,$(prefix),g" \
-e "s,@fish_build_version\@,$(FISH_BUILD_VERSION),g" \
@@ -481,14 +454,12 @@ doc.h: $(HDR_FILES)
#
# Compile translation files to binary format
#
-
%.gmo:
msgfmt -o $@ $*.po
#
# Update existing po file or copy messages.pot
#
-
%.po:messages.pot
if test -f $*.po; then \
msgmerge -U --backup=existing $*.po messages.pot;\
@@ -499,13 +470,10 @@ doc.h: $(HDR_FILES)
#
# Create a template translation object
#
-
messages.pot: src/*.cpp src/*.h share/completions/*.fish share/functions/*.fish
xgettext -k_ -kN_ src/*.cpp src/*.h -o messages.pot
xgettext -j -k_ -kN_ -k--description -LShell --from-code=UTF-8 share/completions/*.fish share/functions/*.fish -o messages.pot
-builtin.o: $(BUILTIN_FILES)
-
ifdef EXTRA_PCRE2
src/builtin_string.cpp: $(PCRE2_H)
endif
@@ -536,7 +504,6 @@ endif
#
# There ought to be something simpler.
#
-
share/man: $(HELP_SRC) lexicon_filter
-mkdir share/man
touch share/man
@@ -552,7 +519,6 @@ share/man: $(HELP_SRC) lexicon_filter
# Check for an incompatible installed fish version, and fail with an
# error if found
#
-
check-uninstall:
if test -f $(DESTDIR)$(sysconfdir)/fish.d/fish_function.fish -o -f $(DESTDIR)$(sysconfdir)/fish.d/fish_complete.fish; then \
echo;\
@@ -608,7 +574,6 @@ check-legacy-binaries:
# darcs repo doesn't preserve the executable bit, so this needs to be
# run after checkout.
#
-
install-sh:
if test -x $@; then true; else chmod 755 $@; fi
.PHONY: install-sh
@@ -616,7 +581,6 @@ install-sh:
#
# Try to install after checking for incompatible installed versions.
#
-
install: all install-sh check-uninstall install-force check-legacy-binaries
@echo fish is now installed on your system.
@echo To run fish, type \'fish\' in your terminal.
@@ -663,9 +627,9 @@ install-force: all install-translations
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish/conf.d
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions
- $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/vendor_completions.d
- $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/vendor_functions.d
- $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/vendor_conf.d
+ $(INSTALL) -m 755 -d $(DESTDIR)$(extra_completionsdir)
+ $(INSTALL) -m 755 -d $(DESTDIR)$(extra_functionsdir)
+ $(INSTALL) -m 755 -d $(DESTDIR)$(extra_confdir)
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/man/man1
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools
@@ -675,6 +639,7 @@ install-force: all install-translations
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts
$(INSTALL) -m 644 etc/config.fish $(DESTDIR)$(sysconfdir)/fish/
$(INSTALL) -m 644 share/config.fish $(DESTDIR)$(datadir)/fish/
+ $(INSTALL) -m 644 share/__fish_build_paths.fish $(DESTDIR)$(datadir)/fish/
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/pkgconfig
$(INSTALL) -m 644 fish.pc $(DESTDIR)$(datadir)/pkgconfig
for i in $(COMPLETIONS_DIR_FILES:%='%'); do \
@@ -727,11 +692,9 @@ install-force: all install-translations
done;
.PHONY: install-force
-
#
# Uninstall this fish version
#
-
uninstall: uninstall-translations
-for i in $(PROGRAMS); do \
rm -f $(DESTDIR)$(bindir)/$$i; \
@@ -758,7 +721,6 @@ uninstall: uninstall-translations
# the sysadmin. But if 'make install' detects a file confligt, it
# suggests using this target.
#
-
uninstall-legacy: uninstall
-rm -f $(DESTDIR)$(sysconfdir)/fish.d/fish_interactive.fish
-rm -f $(DESTDIR)$(sysconfdir)/fish.d/fish_complete.fish
@@ -792,7 +754,6 @@ uninstall-translations:
rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/fish.mo
.PHONY: uninstall-translations
-
#
# The build rules for all the commands
#
@@ -812,15 +773,14 @@ obj:
#
# Build the fish program.
#
-
-fish: $(FISH_OBJS) obj/fish.o $(EXTRA_PCRE2)
+fish: obj/fish.o $(FISH_OBJS) $(EXTRA_PCRE2)
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_OBJS) obj/fish.o $(LIBS) -o $@
$(PCRE2_LIB): $(PCRE2_H)
$(MAKE) -C $(PCRE2_DIR) libpcre2-$(PCRE2_WIDTH).la
$(PCRE2_H):
- (cd $(PCRE2_DIR) && ./config.status --enable-maintainer-mode)
+ (cd $(PCRE2_DIR) && ./config.status)
#
# Build the fish_tests program.
@@ -835,12 +795,13 @@ fish_indent: $(FISH_INDENT_OBJS) $(EXTRA_PCRE2)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(FISH_INDENT_OBJS) $(LIBS) -o $@
#
-# Neat little program to show output from terminal
+# Build the fish_key_reader program to show input from the terminal. Note that
+# fish_key_reader doesn't need all of the object files that fish does but it
+# does need a significant number so it's easier to just use the same list.
#
-key_reader: $(FISH_OBJS) $(EXTRA_PCRE2) obj/key_reader.o
+fish_key_reader: $(FISH_OBJS) $(EXTRA_PCRE2) obj/fish_key_reader.o
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $^ $(LIBS) -o $@
-
#
# Update dependencies
# Unfortunately makedepend cannot handle source files in one directory
@@ -858,46 +819,61 @@ depend:
cp config.h /tmp/fish_make_depend/
mv $(subst obj/,/tmp/fish_make_depend/src/,$(FISH_ALL_OBJS:.o=.cpp)) /tmp/fish_make_depend/
cd /tmp/fish_make_depend && \
- makedepend -f$(CURDIR)/Makefile.in -pobj/ -Y -Isrc *.cpp
+ makedepend -f$(CURDIR)/Makefile.in -pobj/ -Y -Isrc *.cpp
rm -Rf /tmp/fish_make_depend
./config.status
.PHONY: depend
-# Include What You Use
-iwyu:
- # Requires the --keep-going flag as it always returns 1
- # Can't set MAKEFLAGS on a target-specific basic
- $(MAKE) -k _iwyu CXX=include-what-you-use
-_iwyu: clean $(PROGRAMS)
-.PHONY: iwyu _iwyu
+#
+# Lint the code. This only deals with C++ files.
+#
+lint:
+ build_tools/lint.fish $(CXX) $(CXXFLAGS)
+lint-all:
+ build_tools/lint.fish $(CXX) --all $(CXXFLAGS)
+.PHONY: lint lint-all
+
+#
+# Run the code through the style refomatter. This handles both C++ files and
+# fish scripts (*.fish).
+#
+style:
+ build_tools/style.fish
+style-all:
+ build_tools/style.fish --all
+.PHONY: lint lint-all
#
# Cleanup targets
#
+#
# Restore the source tree to the state right after extracting a tarball.
+#
distclean: clean
$(MAKE) -C $(PCRE2_DIR) distclean || true
rm -f config.status config.log config.h Makefile
.PHONY: distclean
-
+#
# Remove everything built by the Makefile, but not things that are created by
# the configure script.
#
# Don't delete the docs unless we have Doxygen installed We provide pre-built
# docs in the tarball, and if they get deleted we won't be able to regenerate
# them.
+#
clean:
$(MAKE) -C $(PCRE2_DIR) clean || true
rm -f obj/*.o *.o doc.h doc.tmp
rm -f doc_src/*.doxygen doc_src/*.cpp doc_src/*.o doc_src/commands.hdr
rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
- rm -f $(PROGRAMS) fish_tests key_reader
+ rm -f $(PROGRAMS) fish_tests fish_key_reader
rm -f command_list.txt command_list_toc.txt toc.txt
rm -f doc_src/index.hdr doc_src/commands.hdr
rm -f lexicon_filter lexicon.txt lexicon.log
- rm -f FISH-BUILD-VERSION-FILE fish.pc
+ rm -f compile_commands.json xcodebuild.log
+ rm -f FISH-BUILD-VERSION-FILE fish.pc share/__fish_build_paths.fish
if test "$(HAVE_DOXYGEN)" = 1; then \
rm -rf doc user_doc share/man; \
fi
@@ -908,117 +884,152 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it.
-obj/autoload.o: config.h src/autoload.h src/common.h src/fallback.h
-obj/autoload.o: src/signal.h src/lru.h src/wutil.h src/env.h src/exec.h
-obj/builtin.o: config.h src/signal.h src/fallback.h src/wutil.h src/common.h
-obj/builtin.o: src/builtin.h src/io.h src/function.h src/event.h src/env.h
-obj/builtin.o: src/complete.h src/proc.h src/parse_tree.h src/tokenizer.h
-obj/builtin.o: src/parse_constants.h src/parser.h src/reader.h
-obj/builtin.o: src/highlight.h src/color.h src/wgetopt.h src/input.h
-obj/builtin.o: src/input_common.h src/intern.h src/exec.h src/parse_util.h
-obj/builtin.o: src/parser_keywords.h src/expand.h src/path.h src/history.h
-obj/builtin.o: src/wcstringutil.h src/builtin_set.cpp src/util.h
-obj/builtin.o: src/builtin_commandline.cpp src/builtin_complete.cpp
-obj/builtin.o: src/builtin_ulimit.cpp src/builtin_jobs.cpp
-obj/builtin.o: src/builtin_set_color.cpp src/output.h src/builtin_printf.cpp
-obj/builtin.o: src/builtin_string.cpp
-obj/builtin_test.o: config.h src/common.h src/fallback.h src/signal.h
-obj/builtin_test.o: src/builtin.h src/io.h src/wutil.h src/proc.h
-obj/builtin_test.o: src/parse_tree.h src/tokenizer.h src/parse_constants.h
+obj/autoload.o: src/autoload.h src/common.h config.h src/fallback.h
+obj/autoload.o: src/signal.h src/lru.h src/env.h src/exec.h src/wutil.h
+obj/builtin.o: src/builtin.h src/common.h config.h src/fallback.h
+obj/builtin.o: src/signal.h src/builtin_commandline.h src/builtin_complete.h
+obj/builtin.o: src/builtin_jobs.h src/builtin_printf.h src/builtin_set.h
+obj/builtin.o: src/builtin_set_color.h src/builtin_string.h
+obj/builtin.o: src/builtin_test.h src/builtin_ulimit.h src/complete.h
+obj/builtin.o: src/env.h src/event.h src/exec.h src/expand.h
+obj/builtin.o: src/parse_constants.h src/function.h src/highlight.h
+obj/builtin.o: src/color.h src/history.h src/wutil.h src/input.h src/intern.h
+obj/builtin.o: src/io.h src/parse_util.h src/tokenizer.h src/parser.h
+obj/builtin.o: src/proc.h src/parse_tree.h src/parser_keywords.h src/path.h
+obj/builtin.o: src/reader.h src/wcstringutil.h src/wgetopt.h
+obj/builtin_commandline.o: src/builtin.h src/common.h config.h src/fallback.h
+obj/builtin_commandline.o: src/signal.h src/input.h src/env.h src/io.h
+obj/builtin_commandline.o: src/parse_util.h src/parse_constants.h
+obj/builtin_commandline.o: src/tokenizer.h src/proc.h src/parse_tree.h
+obj/builtin_commandline.o: src/reader.h src/complete.h src/highlight.h
+obj/builtin_commandline.o: src/color.h src/util.h src/wgetopt.h src/wutil.h
+obj/builtin_complete.o: src/builtin.h src/common.h config.h src/fallback.h
+obj/builtin_complete.o: src/signal.h src/complete.h src/env.h src/io.h
+obj/builtin_complete.o: src/parse_constants.h src/parse_util.h
+obj/builtin_complete.o: src/tokenizer.h src/parser.h src/proc.h
+obj/builtin_complete.o: src/parse_tree.h src/event.h src/expand.h
+obj/builtin_complete.o: src/reader.h src/highlight.h src/color.h
+obj/builtin_complete.o: src/wgetopt.h src/wutil.h
+obj/builtin_jobs.o: config.h src/builtin.h src/common.h src/fallback.h
+obj/builtin_jobs.o: src/signal.h src/io.h src/proc.h src/parse_tree.h
+obj/builtin_jobs.o: src/tokenizer.h src/parse_constants.h src/wgetopt.h
+obj/builtin_jobs.o: src/wutil.h
+obj/builtin_printf.o: src/builtin.h src/common.h config.h src/fallback.h
+obj/builtin_printf.o: src/signal.h src/io.h src/proc.h src/parse_tree.h
+obj/builtin_printf.o: src/tokenizer.h src/parse_constants.h src/wutil.h
+obj/builtin_set.o: src/builtin.h src/common.h config.h src/fallback.h
+obj/builtin_set.o: src/signal.h src/env.h src/expand.h src/parse_constants.h
+obj/builtin_set.o: src/io.h src/proc.h src/parse_tree.h src/tokenizer.h
+obj/builtin_set.o: src/wgetopt.h src/wutil.h
+obj/builtin_set_color.o: config.h src/builtin.h src/common.h src/fallback.h
+obj/builtin_set_color.o: src/signal.h src/color.h src/io.h src/output.h
+obj/builtin_set_color.o: src/proc.h src/parse_tree.h src/tokenizer.h
+obj/builtin_set_color.o: src/parse_constants.h src/wgetopt.h src/wutil.h
+obj/builtin_string.o: config.h src/builtin.h src/common.h src/fallback.h
+obj/builtin_string.o: src/signal.h src/io.h src/parse_util.h
+obj/builtin_string.o: src/parse_constants.h src/tokenizer.h src/wgetopt.h
+obj/builtin_string.o: src/wildcard.h src/expand.h src/complete.h src/wutil.h
+obj/builtin_test.o: src/builtin.h src/common.h config.h src/fallback.h
+obj/builtin_test.o: src/signal.h src/io.h src/proc.h src/parse_tree.h
+obj/builtin_test.o: src/tokenizer.h src/parse_constants.h src/wutil.h
+obj/builtin_ulimit.o: src/builtin.h src/common.h config.h src/fallback.h
+obj/builtin_ulimit.o: src/signal.h src/io.h src/util.h src/wgetopt.h
+obj/builtin_ulimit.o: src/wutil.h
obj/color.o: src/color.h src/common.h config.h src/fallback.h src/signal.h
obj/common.o: config.h src/signal.h src/fallback.h src/wutil.h src/common.h
-obj/common.o: src/expand.h src/parse_constants.h src/wildcard.h
-obj/common.o: src/complete.h src/util.cpp src/util.h src/fallback.cpp
-obj/complete.o: config.h src/fallback.h src/signal.h src/util.h
+obj/common.o: src/expand.h src/parse_constants.h src/util.h src/wildcard.h
+obj/common.o: src/complete.h
+obj/complete.o: src/fallback.h config.h src/signal.h src/util.h
obj/complete.o: src/wildcard.h src/common.h src/expand.h
obj/complete.o: src/parse_constants.h src/complete.h src/proc.h src/io.h
obj/complete.o: src/parse_tree.h src/tokenizer.h src/parser.h src/event.h
obj/complete.o: src/function.h src/env.h src/builtin.h src/exec.h
obj/complete.o: src/parse_util.h src/wutil.h src/path.h src/iothread.h
obj/complete.o: src/autoload.h src/lru.h
-obj/env.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
+obj/env.o: src/fallback.h config.h src/signal.h src/wutil.h src/common.h
obj/env.o: src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
obj/env.o: src/parse_constants.h src/env.h src/sanity.h src/expand.h
obj/env.o: src/history.h src/reader.h src/complete.h src/highlight.h
-obj/env.o: src/color.h src/env_universal_common.h src/input.h
-obj/env.o: src/input_common.h src/event.h src/path.h src/fish_version.h
+obj/env.o: src/color.h src/env_universal_common.h src/input.h src/event.h
+obj/env.o: src/path.h src/fish_version.h src/input_common.h
obj/env_universal_common.o: config.h src/env_universal_common.h src/common.h
obj/env_universal_common.o: src/fallback.h src/signal.h src/wutil.h src/env.h
obj/env_universal_common.o: src/util.h src/utf8.h
-obj/event.o: config.h src/signal.h src/fallback.h src/wutil.h src/common.h
+obj/event.o: src/signal.h src/fallback.h config.h src/wutil.h src/common.h
obj/event.o: src/input_common.h src/proc.h src/io.h src/parse_tree.h
obj/event.o: src/tokenizer.h src/parse_constants.h src/parser.h src/event.h
-obj/exec.o: config.h src/signal.h src/fallback.h src/postfork.h src/io.h
-obj/exec.o: src/common.h src/wutil.h src/proc.h src/parse_tree.h
-obj/exec.o: src/tokenizer.h src/parse_constants.h src/exec.h src/parser.h
-obj/exec.o: src/event.h src/builtin.h src/function.h src/env.h
-obj/exec.o: src/parse_util.h
+obj/event.o: src/expand.h
+obj/exec.o: config.h src/signal.h src/fallback.h src/postfork.h src/common.h
+obj/exec.o: src/wutil.h src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
+obj/exec.o: src/parse_constants.h src/exec.h src/parser.h src/event.h
+obj/exec.o: src/expand.h src/builtin.h src/function.h src/env.h src/reader.h
+obj/exec.o: src/complete.h src/highlight.h src/color.h
obj/expand.o: config.h src/fallback.h src/signal.h src/util.h src/common.h
obj/expand.o: src/wutil.h src/env.h src/proc.h src/io.h src/parse_tree.h
-obj/expand.o: src/tokenizer.h src/parse_constants.h src/parser.h src/event.h
-obj/expand.o: src/expand.h src/wildcard.h src/complete.h src/exec.h
-obj/expand.o: src/iothread.h src/parse_util.h
+obj/expand.o: src/tokenizer.h src/parse_constants.h src/path.h src/expand.h
+obj/expand.o: src/wildcard.h src/complete.h src/exec.h src/iothread.h
+obj/expand.o: src/parse_util.h
+obj/fallback.o: config.h src/signal.h src/fallback.h src/util.h
obj/fish.o: config.h src/fallback.h src/signal.h src/common.h src/reader.h
-obj/fish.o: src/io.h src/complete.h src/highlight.h src/env.h src/color.h
+obj/fish.o: src/complete.h src/highlight.h src/env.h src/color.h
obj/fish.o: src/parse_constants.h src/builtin.h src/function.h src/event.h
-obj/fish.o: src/wutil.h src/proc.h src/parse_tree.h src/tokenizer.h
-obj/fish.o: src/parser.h src/expand.h src/intern.h src/history.h src/path.h
-obj/fish.o: src/input.h src/input_common.h src/fish_version.h
-obj/fish_indent.o: config.h src/color.h src/common.h src/fallback.h
+obj/fish.o: src/wutil.h src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
+obj/fish.o: src/parser.h src/expand.h src/history.h src/path.h src/input.h
+obj/fish.o: src/fish_version.h src/input_common.h src/wildcard.h
+obj/fish_indent.o: src/color.h src/common.h config.h src/fallback.h
obj/fish_indent.o: src/signal.h src/highlight.h src/env.h
obj/fish_indent.o: src/parse_constants.h src/wutil.h src/output.h src/input.h
-obj/fish_indent.o: src/input_common.h src/parse_tree.h src/tokenizer.h
-obj/fish_indent.o: src/print_help.h src/fish_version.h
-obj/fish_tests.o: config.h src/signal.h src/fallback.h src/util.h
+obj/fish_indent.o: src/parse_tree.h src/tokenizer.h src/print_help.h
+obj/fish_indent.o: src/fish_version.h
+obj/fish_tests.o: src/signal.h src/fallback.h config.h src/util.h
obj/fish_tests.o: src/common.h src/proc.h src/io.h src/parse_tree.h
obj/fish_tests.o: src/tokenizer.h src/parse_constants.h src/reader.h
obj/fish_tests.o: src/complete.h src/highlight.h src/env.h src/color.h
-obj/fish_tests.o: src/builtin.h src/function.h src/event.h src/autoload.h
-obj/fish_tests.o: src/lru.h src/wutil.h src/expand.h src/parser.h
-obj/fish_tests.o: src/output.h src/exec.h src/path.h src/history.h
-obj/fish_tests.o: src/iothread.h src/postfork.h src/parse_util.h src/pager.h
-obj/fish_tests.o: src/screen.h src/input.h src/input_common.h src/wildcard.h
-obj/fish_tests.o: src/utf8.h src/env_universal_common.h src/wcstringutil.h
+obj/fish_tests.o: src/builtin.h src/function.h src/event.h src/wutil.h
+obj/fish_tests.o: src/expand.h src/parser.h src/path.h src/history.h
+obj/fish_tests.o: src/iothread.h src/parse_util.h src/pager.h src/screen.h
+obj/fish_tests.o: src/input.h src/wildcard.h src/utf8.h
+obj/fish_tests.o: src/env_universal_common.h src/wcstringutil.h src/lru.h
+obj/fish_tests.o: src/input_common.h
obj/fish_version.o: src/fish_version.h
-obj/function.o: config.h src/wutil.h src/common.h src/fallback.h src/signal.h
+obj/function.o: src/wutil.h src/common.h config.h src/fallback.h src/signal.h
obj/function.o: src/autoload.h src/lru.h src/function.h src/event.h src/env.h
-obj/function.o: src/intern.h src/reader.h src/io.h src/complete.h
-obj/function.o: src/highlight.h src/color.h src/parse_constants.h
-obj/function.o: src/parser_keywords.h
-obj/highlight.o: config.h src/fallback.h src/signal.h src/wutil.h
+obj/function.o: src/intern.h src/reader.h src/complete.h src/highlight.h
+obj/function.o: src/color.h src/parse_constants.h src/parser_keywords.h
+obj/highlight.o: src/fallback.h config.h src/signal.h src/wutil.h
obj/highlight.o: src/common.h src/highlight.h src/env.h src/color.h
obj/highlight.o: src/tokenizer.h src/parse_util.h src/parse_constants.h
-obj/highlight.o: src/builtin.h src/io.h src/function.h src/event.h
-obj/highlight.o: src/expand.h src/output.h src/wildcard.h src/complete.h
-obj/highlight.o: src/path.h src/history.h src/parse_tree.h
-obj/history.o: config.h src/fallback.h src/signal.h src/sanity.h src/reader.h
-obj/history.o: src/io.h src/common.h src/complete.h src/highlight.h src/env.h
-obj/history.o: src/color.h src/parse_constants.h src/parse_tree.h
-obj/history.o: src/tokenizer.h src/wutil.h src/history.h src/path.h
-obj/history.o: src/iothread.h src/lru.h
+obj/highlight.o: src/builtin.h src/function.h src/event.h src/expand.h
+obj/highlight.o: src/output.h src/wildcard.h src/complete.h src/path.h
+obj/highlight.o: src/history.h src/parse_tree.h
+obj/history.o: src/common.h config.h src/fallback.h src/signal.h src/env.h
+obj/history.o: src/history.h src/wutil.h src/iothread.h src/lru.h
+obj/history.o: src/parse_constants.h src/parse_tree.h src/tokenizer.h
+obj/history.o: src/path.h src/reader.h src/complete.h src/highlight.h
+obj/history.o: src/color.h src/sanity.h
+obj/input.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
+obj/input.o: src/reader.h src/complete.h src/highlight.h src/env.h
+obj/input.o: src/color.h src/parse_constants.h src/proc.h src/io.h
+obj/input.o: src/parse_tree.h src/tokenizer.h src/input_common.h src/input.h
+obj/input.o: src/parser.h src/event.h src/expand.h src/output.h
obj/input_common.o: config.h src/fallback.h src/signal.h src/util.h
obj/input_common.o: src/common.h src/input_common.h
obj/input_common.o: src/env_universal_common.h src/wutil.h src/env.h
obj/input_common.o: src/iothread.h
-obj/input.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
-obj/input.o: src/reader.h src/io.h src/complete.h src/highlight.h src/env.h
-obj/input.o: src/color.h src/parse_constants.h src/proc.h src/parse_tree.h
-obj/input.o: src/tokenizer.h src/input_common.h src/input.h src/parser.h
-obj/input.o: src/event.h src/output.h
-obj/intern.o: config.h src/fallback.h src/signal.h src/common.h src/intern.h
-obj/io.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
+obj/intern.o: src/fallback.h config.h src/signal.h src/common.h src/intern.h
+obj/io.o: src/fallback.h config.h src/signal.h src/wutil.h src/common.h
obj/io.o: src/exec.h src/io.h
-obj/iothread.o: config.h src/iothread.h src/common.h src/fallback.h
-obj/iothread.o: src/signal.h
-obj/key_reader.o: config.h src/common.h src/fallback.h src/signal.h
-obj/key_reader.o: src/input_common.h
-obj/kill.o: config.h src/fallback.h src/signal.h src/kill.h src/common.h
+obj/iothread.o: src/signal.h src/iothread.h src/common.h config.h
+obj/iothread.o: src/fallback.h
+obj/fish_key_reader.o: src/common.h config.h src/fallback.h src/signal.h
+obj/fish_key_reader.o: src/input_common.h
+obj/kill.o: src/fallback.h config.h src/signal.h src/kill.h src/common.h
obj/kill.o: src/env.h src/exec.h src/path.h
obj/output.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
obj/output.o: src/output.h src/color.h
-obj/pager.o: config.h src/util.h src/wutil.h src/common.h src/fallback.h
+obj/pager.o: src/util.h src/wutil.h src/common.h config.h src/fallback.h
obj/pager.o: src/signal.h src/pager.h src/complete.h src/screen.h
-obj/pager.o: src/highlight.h src/env.h src/color.h src/reader.h src/io.h
+obj/pager.o: src/highlight.h src/env.h src/color.h src/reader.h
obj/pager.o: src/parse_constants.h
obj/parse_execution.o: src/parse_execution.h src/common.h config.h
obj/parse_execution.o: src/fallback.h src/signal.h src/io.h
@@ -1028,26 +1039,26 @@ obj/parse_execution.o: src/parse_util.h src/complete.h src/wildcard.h
obj/parse_execution.o: src/expand.h src/parser.h src/reader.h src/highlight.h
obj/parse_execution.o: src/color.h src/wutil.h src/path.h src/function.h
obj/parse_execution.o: src/builtin.h src/exec.h
-obj/parse_productions.o: src/parse_productions.h src/common.h config.h
-obj/parse_productions.o: src/fallback.h src/signal.h src/parse_constants.h
-obj/parse_productions.o: src/parse_tree.h src/tokenizer.h
-obj/parser.o: config.h src/fallback.h src/signal.h src/common.h src/wutil.h
-obj/parser.o: src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
-obj/parser.o: src/parse_constants.h src/parser.h src/event.h src/function.h
-obj/parser.o: src/env.h src/expand.h src/reader.h src/complete.h
-obj/parser.o: src/highlight.h src/color.h src/sanity.h src/intern.h
-obj/parser.o: src/parse_util.h src/parse_execution.h
-obj/parser_keywords.o: config.h src/fallback.h src/signal.h src/common.h
-obj/parser_keywords.o: src/parser_keywords.h
+obj/parse_productions.o: src/parse_tree.h src/common.h config.h
+obj/parse_productions.o: src/fallback.h src/signal.h src/tokenizer.h
+obj/parse_productions.o: src/parse_constants.h src/parse_productions.h
obj/parse_tree.o: src/common.h config.h src/fallback.h src/signal.h
obj/parse_tree.o: src/parse_constants.h src/parse_productions.h
obj/parse_tree.o: src/parse_tree.h src/tokenizer.h src/wutil.h src/proc.h
obj/parse_tree.o: src/io.h
-obj/parse_util.o: config.h src/fallback.h src/signal.h src/util.h src/wutil.h
+obj/parse_util.o: src/fallback.h config.h src/signal.h src/util.h src/wutil.h
obj/parse_util.o: src/common.h src/tokenizer.h src/parse_util.h
-obj/parse_util.o: src/parse_constants.h src/expand.h src/env.h src/wildcard.h
-obj/parse_util.o: src/complete.h src/parse_tree.h src/builtin.h src/io.h
-obj/path.o: config.h src/fallback.h src/signal.h src/common.h src/env.h
+obj/parse_util.o: src/parse_constants.h src/expand.h src/wildcard.h
+obj/parse_util.o: src/complete.h src/parse_tree.h src/builtin.h
+obj/parser.o: src/fallback.h config.h src/signal.h src/common.h src/wutil.h
+obj/parser.o: src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
+obj/parser.o: src/parse_constants.h src/parser.h src/event.h src/expand.h
+obj/parser.o: src/function.h src/env.h src/reader.h src/complete.h
+obj/parser.o: src/highlight.h src/color.h src/sanity.h src/intern.h
+obj/parser.o: src/parse_util.h src/parse_execution.h
+obj/parser_keywords.o: src/fallback.h config.h src/signal.h src/common.h
+obj/parser_keywords.o: src/parser_keywords.h
+obj/path.o: src/fallback.h config.h src/signal.h src/common.h src/env.h
obj/path.o: src/wutil.h src/path.h src/expand.h src/parse_constants.h
obj/postfork.o: src/signal.h src/common.h config.h src/fallback.h src/proc.h
obj/postfork.o: src/io.h src/parse_tree.h src/tokenizer.h
@@ -1058,36 +1069,37 @@ obj/proc.o: config.h src/signal.h src/fallback.h src/util.h src/wutil.h
obj/proc.o: src/common.h src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
obj/proc.o: src/parse_constants.h src/reader.h src/complete.h src/highlight.h
obj/proc.o: src/env.h src/color.h src/sanity.h src/parser.h src/event.h
-obj/proc.o: src/output.h
+obj/proc.o: src/expand.h src/output.h
obj/reader.o: config.h src/signal.h src/fallback.h src/util.h src/wutil.h
obj/reader.o: src/common.h src/highlight.h src/env.h src/color.h src/reader.h
-obj/reader.o: src/io.h src/complete.h src/parse_constants.h src/proc.h
+obj/reader.o: src/complete.h src/parse_constants.h src/proc.h src/io.h
obj/reader.o: src/parse_tree.h src/tokenizer.h src/parser.h src/event.h
-obj/reader.o: src/history.h src/sanity.h src/exec.h src/expand.h src/kill.h
+obj/reader.o: src/expand.h src/history.h src/sanity.h src/exec.h src/kill.h
obj/reader.o: src/input_common.h src/input.h src/function.h src/output.h
obj/reader.o: src/screen.h src/iothread.h src/intern.h src/parse_util.h
obj/reader.o: src/pager.h
-obj/sanity.o: config.h src/fallback.h src/signal.h src/common.h src/sanity.h
+obj/sanity.o: src/fallback.h config.h src/signal.h src/common.h src/sanity.h
obj/sanity.o: src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
obj/sanity.o: src/parse_constants.h src/history.h src/wutil.h src/reader.h
obj/sanity.o: src/complete.h src/highlight.h src/env.h src/color.h src/kill.h
obj/screen.o: config.h src/fallback.h src/signal.h src/common.h src/util.h
obj/screen.o: src/output.h src/color.h src/highlight.h src/env.h src/screen.h
-obj/screen.o: src/pager.h src/complete.h src/reader.h src/io.h
-obj/screen.o: src/parse_constants.h
-obj/signal.o: config.h src/signal.h src/common.h src/fallback.h src/wutil.h
-obj/signal.o: src/event.h src/reader.h src/io.h src/complete.h
-obj/signal.o: src/highlight.h src/env.h src/color.h src/parse_constants.h
-obj/signal.o: src/proc.h src/parse_tree.h src/tokenizer.h
-obj/tokenizer.o: config.h src/fallback.h src/signal.h src/common.h
+obj/screen.o: src/pager.h src/complete.h src/reader.h src/parse_constants.h
+obj/signal.o: src/signal.h src/common.h config.h src/fallback.h src/wutil.h
+obj/signal.o: src/event.h src/reader.h src/complete.h src/highlight.h
+obj/signal.o: src/env.h src/color.h src/parse_constants.h src/proc.h src/io.h
+obj/signal.o: src/parse_tree.h src/tokenizer.h
+obj/tokenizer.o: src/fallback.h config.h src/signal.h src/common.h
obj/tokenizer.o: src/wutil.h src/tokenizer.h
obj/utf8.o: src/utf8.h
-obj/wcstringutil.o: config.h src/wcstringutil.h src/common.h src/fallback.h
-obj/wcstringutil.o: src/signal.h
+obj/util.o: src/fallback.h config.h src/signal.h src/util.h src/common.h
+obj/util.o: src/wutil.h
+obj/wcstringutil.o: src/common.h config.h src/fallback.h src/signal.h
+obj/wcstringutil.o: src/wcstringutil.h
obj/wgetopt.o: config.h src/common.h src/fallback.h src/signal.h
obj/wgetopt.o: src/wgetopt.h src/wutil.h
-obj/wildcard.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
+obj/wildcard.o: src/fallback.h config.h src/signal.h src/wutil.h src/common.h
obj/wildcard.o: src/wildcard.h src/expand.h src/parse_constants.h
-obj/wildcard.o: src/complete.h src/reader.h src/io.h src/highlight.h
-obj/wildcard.o: src/env.h src/color.h
-obj/wutil.o: config.h src/fallback.h src/signal.h src/common.h src/wutil.h
+obj/wildcard.o: src/complete.h src/reader.h src/highlight.h src/env.h
+obj/wildcard.o: src/color.h
+obj/wutil.o: config.h src/common.h src/fallback.h src/signal.h src/wutil.h
diff --git a/README.md b/README.md
index bfbd790ef..7dd426bc8 100644
--- a/README.md
+++ b/README.md
@@ -13,9 +13,9 @@ Detailed user documentation is available by running `help` within fish, and also
## Building
-fish is written in a sane subset of C++98, with a few components from C++TR1. It builds successfully with g++ 4.2 or later, and with clang. It also will build as C++11.
+Fish can be built using a C++11 environment but only requires C++03. It builds successfully with g++ 4.2 or later, and with clang. This allows fish to run on older systems such as OS X Snow Leopard (released in 2009).
-fish can be built using autotools or Xcode. autoconf 2.60 or later is required to build from git versions, but is not required for releases.
+Fish can be built using autotools or Xcode. autoconf 2.60 or later is required to build from git versions, but is not required for releases.
fish depends on a curses implementation, such as ncurses. The headers and libraries are required for building.
@@ -54,32 +54,6 @@ On RedHat, CentOS, or Amazon EC2:
sudo yum install ncurses-devel
-## Testing
-
-The source code for fish includes a large collection of tests. If you are making any changes to fish, running these tests is highly recommended to make sure the behaviour remains consistent.
-
-### Local testing
-
-The tests can be run on your local computer on all operating systems.
-
-Running the tests is only supported from the Autotools build. On OS X, you will require an installation of autoconf; we suggest using [Homebrew](http://brew.sh/) to install these tools.
-
- autoconf
- ./configure
- make test [gmake on BSD]
-
-### Travis CI Build and Test
-
-The Travis Continuous Integration services can be used to test your changes across multiple platforms. You will need to [fork the fish-shell repository on GitHub](https://help.github.com/articles/fork-a-repo/), or push a copy of the code to your GitHub account.
-
- 1. [Sign in to Travis CI](https://travis-ci.org/auth) with your GitHub account, accepting the GitHub access permissions confirmation.
- 2. Once you're signed in, and your repositories are synchronised, go to your [profile page](https://travis-ci.org/profile) and enable the fish-shell repository.
- 3. Push your changes to GitHub.
-
-You'll receive an email when the tests are complete telling you whether or not any tests failed.
-
-You'll find the configuration used to control Travis in the `.travis.yml` file.
-
## Runtime Dependencies
fish requires a curses implementation, such as ncurses, to run.
@@ -106,12 +80,20 @@ If you wish to use fish as your default shell, use the following command:
chsh will prompt you for your password, and change your default shell. Substitute "/usr/local/bin/fish" with whatever path to fish is in your /etc/shells file.
+Use the following command if you didn't already add your fish path to /etc/shells.
+
+ echo /usr/local/bin/fish | sudo tee -a /etc/shells
+
To switch your default shell back, you can run:
chsh -s /bin/bash
Substitute /bin/bash with /bin/tcsh or /bin/zsh as appropriate.
+## Contributing Changes to the Code
+
+See the [Guide for Developers](CONTRIBUTING.md).
+
## Contact Us
Questions, comments, rants and raves can be posted to the official fish mailing list at or join us on our [gitter.im channel](https://gitter.im/fish-shell/fish-shell) or IRC channel [#fish at irc.oftc.net](https://webchat.oftc.net/?channels=fish). Or use the [fish tag on Stackoverflow](https://stackoverflow.com/questions/tagged/fish).
diff --git a/build_tools/description-pak b/build_tools/description-pak
deleted file mode 100644
index 029bc12ed..000000000
--- a/build_tools/description-pak
+++ /dev/null
@@ -1,3 +0,0 @@
-This is the_ridiculous'fish s delightful fork of, fish friendly interactive shell. For more information, visit http://ridiculousfish.com/shell/ .
-
-This installer will install fish, but will not modify your /etc/shells file or your default shell. I trust you know how to do that yourself if you care to!
diff --git a/build_tools/iwyu.linux.imp b/build_tools/iwyu.linux.imp
new file mode 100644
index 000000000..9152cfb9d
--- /dev/null
+++ b/build_tools/iwyu.linux.imp
@@ -0,0 +1,28 @@
+# Map file for the include-what-you-use tool on Linux.
+[
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "public", "", "public"] },
+ { include: ["", "public", "", "public"] },
+ { include: ["", "public", "", "public"] },
+ { include: ["", "public", "", "public"] },
+
+ { symbol: ["size_t", "private", "", "public"] },
+ { symbol: ["size_t", "private", "", "public"] },
+ { symbol: ["size_t", "private", "", "public"] },
+ { symbol: ["intmax_t", "private", "", "public"] },
+ { symbol: ["intmax_t", "private", "", "public"] },
+ { symbol: ["uint32_t", "private", "", "public"] },
+ { symbol: ["uint32_t", "private", "", "public"] },
+ { symbol: ["uint64_t", "private", "", "public"] },
+ { symbol: ["uint64_t", "private", "", "public"] },
+ { symbol: ["uintmax_t", "private", "", "public"] },
+ { symbol: ["uintmax_t", "private", "", "public"] },
+ { symbol: ["clock_gettime", "private", "", "public"] },
+ { symbol: ["timespec", "private", "", "public"] },
+ { symbol: ["memset", "private", "", "public"] },
+ { symbol: ["strerror", "private", "", "public"] },
+]
diff --git a/build_tools/iwyu.osx.imp b/build_tools/iwyu.osx.imp
new file mode 100644
index 000000000..ee9353021
--- /dev/null
+++ b/build_tools/iwyu.osx.imp
@@ -0,0 +1,98 @@
+# Map file for the include-what-you-use tool on OS X. For some reason
+# the version installed by HomeBrew doesn't have useful mappings for the
+# system provided private headers.
+[
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["<_wctype.h>", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["<_types/_intmax_t.h>", "private", "", "public"] },
+ { include: ["<_types/_uintmax_t.h>", "private", "", "public"] },
+ { include: ["<_types/_uint8_t.h>", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["<_types/_uint64_t.h>", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["", "private", "", "public"] },
+ { include: ["<__functional_base>", "private", "", "public"] },
+ { include: ["<__functional_base>", "private", "", "public"] },
+ { include: ["<__functional_base>", "private", "", "public"] },
+ { include: ["<__tree>", "private", "