Git Product home page Git Product logo

Comments (25)

dylankb avatar dylankb commented on May 20, 2024 1

I followed your instructions and entered ble-edit/detach and got an error that looked something like -bash:ble-decode is not .... Unfortunately I'm not sure if that's correct because when I entered the same command again it closed the session, losing the error text. Every time afterwards that I've entered ble-edit/detach after sourcing I get a different error message -bash: syntax error near unexpected token;.

From that state I ran the commands that you requested. Here's the output:

$ type ble-decode/DEFAULT_KEYMAP
ble-decode/DEFAULT_KEYMAP is a function
ble-decode/DEFAULT_KEYMAP ()
{
    local ret;
    bleopt/get:default_keymap;
    local defmap=$ret;
    if ble-edit/bind/load-keymap-definition "$defmap"; then
        if [[ $defmap == vi ]]; then
            builtin eval -- "$2=vi_imap";
        else
            builtin eval -- "$2=\$defmap";
        fi && ble-decode/keymap/is-keymap "${!2}" && return 0;
    fi;
    echo "ble.sh: The definition of the default keymap \"$bleopt_default_keymap\" is not found. ble.sh uses \"safe\" keymap instead.";
    ble-edit/bind/load-keymap-definition safe && builtin eval -- "$2=safe" && bleopt_default_keymap=safe
}
$ declare -p _ble_decode_emacs_kmap_
declare -- _ble_decode_emacs_kmap_="([0]=\"1:ble/widget/set-mark\" [8]=\"1:ble/widget/delete-region-or backward-char\" [9]=\"1:ble/widget/complete\" [13]=\"1:ble/widget/accept-single-line-or-newline\" [32]=\"1:ble/widget/magic-space\" [45]=\"1:ble/widget/emacs/append-arg\" [48]=\"1:ble/widget/emacs/append-arg\" [49]=\"1:ble/widget/emacs/append-arg\" [50]=\"1:ble/widget/emacs/append-arg\" [51]=\"1:ble/widget/emacs/append-arg\" [52]=\"1:ble/widget/emacs/append-arg\" [53]=\"1:ble/widget/emacs/append-arg\" [54]=\"1:ble/widget/emacs/append-arg\" [55]=\"1:ble/widget/emacs/append-arg\" [56]=\"1:ble/widget/emacs/append-arg\" [57]=\"1:ble/widget/emacs/append-arg\" [127]=\"1:ble/widget/delete-region-or backward-char\" [1114112]=\"1:ble/widget/batch-insert\" [1114113]=\"1:ble/widget/self-insert\" [1114115]=\"1:ble/widget/emacs/__before_widget__\" [1114116]=\"1:ble/widget/emacs/__after_widget__\" [1114117]=\"1:ble/widget/safe/__attach__\" [1114125]=\"1:ble/widget/overwrite-mode\" [1114126]=\"1:ble/widget/@nomarked beginning-of-line\" [1114128]=\"1:ble/widget/delete-region-or forward-char\" [1114129]=\"1:ble/widget/@nomarked end-of-line\" [1114131]=\"1:ble/widget/command-help\" [1114151]=\"1:ble/widget/emacs/bracketed-paste\" [1114153]=\"1:ble/widget/@nomarked backward-line history\" [1114154]=\"1:ble/widget/@nomarked forward-line history\" [1114155]=\"1:ble/widget/@nomarked forward-char\" [1114156]=\"1:ble/widget/@nomarked backward-char\" [1114158]=\"1:ble/widget/auto-complete-enter\" [34668558]=\"1:ble/widget/@marked beginning-of-line\" [34668561]=\"1:ble/widget/@marked end-of-line\" [34668585]=\"1:ble/widget/@marked backward-line\" [34668586]=\"1:ble/widget/@marked forward-line\" [34668587]=\"1:ble/widget/@marked forward-char\" [34668588]=\"1:ble/widget/@marked backward-char\" [67108872]=\"1:ble/widget/emacs/undo\" [67108873]=\"1:ble/widget/menu-complete\" [67108877]=\"1:ble/widget/accept-line\" [67108896]=\"1:ble/widget/set-mark\" [67108909]=\"1:ble/widget/emacs/append-arg\" [67108911]=\"1:ble/widget/emacs/undo\" [67108912]=\"1:ble/widget/emacs/append-arg\" [67108913]=\"1:ble/widget/emacs/append-arg\" [67108914]=\"1:ble/widget/emacs/append-arg\" [67108915]=\"1:ble/widget/emacs/append-arg\" [67108916]=\"1:ble/widget/emacs/append-arg\" [67108917]=\"1:ble/widget/emacs/append-arg\" [67108918]=\"1:ble/widget/emacs/append-arg\" [67108919]=\"1:ble/widget/emacs/append-arg\" [67108920]=\"1:ble/widget/emacs/append-arg\" [67108921]=\"1:ble/widget/emacs/append-arg\" [67108927]=\"1:ble/widget/delete-region-or backward-char\" [67108928]=\"1:ble/widget/set-mark\" [67108956]=\"1:ble/widget/bell\" [67108957]=\"1:ble/widget/bell\" [67108958]=\"1:ble/widget/bell\" [67108959]=\"1:ble/widget/emacs/undo\" [67108961]=\"1:ble/widget/@nomarked beginning-of-line\" [67108962]=\"1:ble/widget/@nomarked backward-char\" [67108963]=\"1:ble/widget/discard-line\" [67108964]=\"1:ble/widget/delete-region-or forward-char-or-exit\" [67108965]=\"1:ble/widget/@nomarked end-of-line\" [67108966]=\"1:ble/widget/@nomarked forward-char\" [67108967]=\"1:ble/widget/bell\" [67108968]=\"1:ble/widget/delete-region-or backward-char\" [67108969]=\"1:ble/widget/complete\" [67108970]=\"1:ble/widget/accept-line\" [67108971]=\"1:ble/widget/kill-forward-line\" [67108972]=\"1:ble/widget/clear-screen\" [67108973]=\"1:ble/widget/accept-single-line-or-newline\" [67108974]=\"1:ble/widget/@nomarked forward-line history\" [67108975]=\"1:ble/widget/accept-and-next\" [67108976]=\"1:ble/widget/@nomarked backward-line history\" [67108977]=\"1:ble/widget/emacs/quoted-insert\" [67108978]=\"1:ble/widget/history-isearch-backward\" [67108979]=\"1:ble/widget/history-isearch-forward\" [67108980]=\"1:ble/widget/transpose-chars\" [67108981]=\"1:ble/widget/kill-backward-line\" [67108982]=\"1:ble/widget/emacs/quoted-insert\" [67108983]=\"1:ble/widget/kill-region-or uword\" [67108984]=\"_\" [67108985]=\"1:ble/widget/yank\" [67108986]=\"1:ble/widget/.SHELL_COMMAND 'fg'\" [67108991]=\"1:ble/widget/emacs/undo\" [68222990]=\"1:ble/widget/@nomarked beginning-of-text\" [68222991]=\"1:ble/widget/history-beginning\" [68222992]=\"1:ble/widget/delete-forward-cword\" [68222993]=\"1:ble/widget/@nomarked end-of-text\" [68222994]=\"1:ble/widget/history-end\" [68223019]=\"1:ble/widget/@nomarked forward-cword\" [68223020]=\"1:ble/widget/@nomarked backward-cword\" [100663393]=\"1:ble/widget/@marked beginning-of-line\" [100663394]=\"1:ble/widget/@marked backward-char\" [100663397]=\"1:ble/widget/@marked end-of-line\" [100663398]=\"1:ble/widget/@marked forward-char\" [100663406]=\"1:ble/widget/@marked forward-line\" [100663408]=\"1:ble/widget/@marked backward-line\" [101777422]=\"1:ble/widget/@marked beginning-of-text\" [101777425]=\"1:ble/widget/@marked end-of-text\" [101777451]=\"1:ble/widget/@marked forward-cword\" [101777452]=\"1:ble/widget/@marked backward-cword\" [134217736]=\"1:ble/widget/copy-backward-sword\" [134217741]=\"1:ble/widget/newline\" [134217760]=\"1:ble/widget/set-mark\" [134217761]=\"1:ble/widget/complete context=command\" [134217764]=\"1:ble/widget/complete context=variable\" [134217767]=\"1:ble/widget/sabbrev-expand\" [134217770]=\"1:ble/widget/complete insert_all\" [134217773]=\"1:ble/widget/emacs/append-arg\" [134217775]=\"1:ble/widget/complete context=filename\" [134217776]=\"1:ble/widget/emacs/append-arg\" [134217777]=\"1:ble/widget/emacs/append-arg\" [134217778]=\"1:ble/widget/emacs/append-arg\" [134217779]=\"1:ble/widget/emacs/append-arg\" [134217780]=\"1:ble/widget/emacs/append-arg\" [134217781]=\"1:ble/widget/emacs/append-arg\" [134217782]=\"1:ble/widget/emacs/append-arg\" [134217783]=\"1:ble/widget/emacs/append-arg\" [134217784]=\"1:ble/widget/emacs/append-arg\" [134217785]=\"1:ble/widget/emacs/append-arg\" [134217788]=\"1:ble/widget/history-beginning\" [134217790]=\"1:ble/widget/history-end\" [134217791]=\"1:ble/widget/complete show_menu\" [134217792]=\"1:ble/widget/complete context=hostname\" [134217794]=\"1:ble/widget/@marked backward-cword\" [134217798]=\"1:ble/widget/@marked forward-cword\" [134217805]=\"1:ble/widget/@marked non-space-beginning-of-line\" [134217820]=\"1:ble/widget/delete-horizontal-space\" [134217822]=\"1:ble/widget/history-expand-line\" [134217826]=\"1:ble/widget/@nomarked backward-cword\" [134217828]=\"1:ble/widget/kill-forward-cword\" [134217830]=\"1:ble/widget/@nomarked forward-cword\" [134217831]=\"1:ble/widget/complete context=glob\" [134217832]=\"1:ble/widget/kill-backward-cword\" [134217836]=\"1:ble/widget/redraw-line\" [134217837]=\"1:ble/widget/@nomarked non-space-beginning-of-line\" [134217842]=\"1:ble/widget/emacs/revert\" [134217847]=\"1:ble/widget/copy-region-or uword\" [134217850]=\"1:ble/widget/.SHELL_COMMAND 'fg'\" [134217854]=\"1:ble/widget/complete context=username\" [134217855]=\"1:ble/widget/copy-backward-sword\" [135331856]=\"1:ble/widget/copy-forward-sword\" [135331883]=\"1:ble/widget/@nomarked forward-sword\" [135331884]=\"1:ble/widget/@nomarked backward-sword\" [167772258]=\"1:ble/widget/@marked backward-cword\" [167772262]=\"1:ble/widget/@marked forward-cword\" [167772269]=\"1:ble/widget/@marked non-space-beginning-of-line\" [168886315]=\"1:ble/widget/@marked forward-sword\" [168886316]=\"1:ble/widget/@marked backward-sword\" [201326655]=\"1:ble/widget/copy-backward-sword\" [201326695]=\"1:ble/widget/bell\" [201326696]=\"1:ble/widget/copy-backward-sword\" [201326701]=\"1:ble/widget/newline\")"
$ ble/is-array _ble_decode_emacs_kmap_; echo $?
1
$ echo "$_ble_base_cache"
/Users/dbarnard/Code/dev-tools/ble-0.3.0/./cache.d/501
$ ls -ld "${XDG_CACHE_HOME:-$HOME/.cache}"
ls: /Users/dbarnard/.cache: No such file or directory

Before I noted that after a fresh unzipping of the directory I'm able to source bleh.sh exactly once before subsequent sourcings return the emacs keymap error. Once thing I forgot to note is the first command post successful source always returns a ` prompt_command_array' error.

$ echo 'hello'
-bash: read: ` prompt_command_array': not a valid identifier
hello
$ echo 'again'
again

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024 1
  1. S-RET

Thanks for looking into those details and providing the escape codes! I have now have S-RET others working correctly.

  1. M-right

Wow, thanks for the thorough explanation. Let me be more specific and you can tell me if the behavior I have is the expected one:

Given terminal input cd d and an autocomplete suggestion of cd do/a/thing I thought that entering M-right would select and move the cursor the first end of the first path segment (i.e changing the current terminal input to cd do/). This is the behavior I get if I use Tab. However instead entering M-right completes to the whole segment cd do/a/thing. I think this is not the expected behavior since normally a / is treated as a delimiter - at least currently in iTerm2 using Natural Text Editing respects the / delimiters with regular (non-autcomplete suggested) Terminal line editor content.

However it's interesting that M-right observe spaces as delimiters in autocomplete suggestions. For example, If I enter e and get a suggestion of echo hello world I can then use M-rightto move one word at a time - i.e I would need to enter M-right 3 times to reach the end of the autocomplete suggestions.

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024 1

Thank you very much for your feedback!

However it's interesting that M-right observe spaces as delimiters in autocomplete suggestions.

This is actually my preference and was an intended one. I added an option to configure the delimiters c294e31 (in master branch not in ble-0.3 because this is a new feature). You can configure the characters to be used for word breaks of M-right by the following settings.

# Example 1: spaces (default)
bleopt complete_auto_wordbreaks=$' \t\n'

# Example 2: spaces + /
bleopt complete_auto_wordbreaks=$' \t\n/'

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024 1

Thanks for all the help!

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024 1

Ah, you clearly explained this before and I overlooked that point. Thanks!

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024 1

The feature works great in ble-0.4 series, but in case you didn't know an error message does pop up when loading ble.sh.

ble/builtin/trap: invalid signal specification "-".

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

Thank you very much for the report!

ble.sh: Failed to load the default keymap. keymap 'emacs' is not defined.

This error typically occurs when only ble.sh is copied during the installation and other related resources are not copied, in particular, when the file keymap/emacs.sh is not copied.

Question 1: Can you provide me the file tree of the directory where Homebrew installed the script file ble.sh? It should be something like the following tree.

blesh
|-- ble.sh
|-- cache.d
|-- keymap
|   |-- emacs.rlfunc.txt
|   |-- emacs.sh
|   |-- vi.sh
|   |-- vi_digraph.sh
|   |-- vi_digraph.txt
|   |-- vi_imap.rlfunc.txt
|   |-- vi_nmap.rlfunc.txt
|   `-- vi_test.sh
|-- lib
|   |-- core-complete.sh
|   |-- core-edit.ignoreeof-messages.txt
|   |-- core-syntax.sh
|   |-- init-bind.sh
|   |-- init-cmap.sh
|   |-- init-term.sh
|   |-- vim-arpeggio.sh
|   `-- vim-surround.sh
`-- tmp

I'm on MacOS and have installed bash via Homebrew

I don't have macOS so I don't have experience on Homebrew, but I suspect that the Homebrew formula that you used is broken.

Question 2: Where did you get Homebrew formula for ble.sh? Or did you define it by yourself? Could you provide me the details of the formula?

Oddly enough if I manually source /bleh.sh

Question 3: Where is that ble.sh located? Is it in the install directory by Homebrew? Or some downloaded version of ble.sh?

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024

Thanks for the quick reply!

This error typically occurs when only ble.sh is copied during the installation and other related resources are not copied, in particular, when the file keymap/emacs.sh is not copied.

Question 1: Can you provide me the file tree of the directory where Homebrew installed the script file ble.sh?

  1. Sorry, if that wasn't clear but I installed bleh.sh manually via the curl/tar commands provided in the project readme - I only mentioned that I upgraded bash via Homebrew.

I do not seem to be missing the keymap/emacs.sh file. Here's the directory contents:

.
├── ble.sh
├── cache.d
│   └── 501
│       ├── ble-decode-bind.30257.UTF-8.bind
│       ├── ble-decode-bind.30257.UTF-8.unbind
│       ├── cmap+default.3.xterm-256color.dump
│       ├── keymap.emacs
│       └── xterm-256color.term
├── keymap
│   ├── emacs.rlfunc.txt
│   ├── emacs.sh
│   ├── vi.sh
│   ├── vi_digraph.sh
│   ├── vi_digraph.txt
│   ├── vi_imap.rlfunc.txt
│   ├── vi_nmap.rlfunc.txt
│   └── vi_test.sh
└── lib
    ├── core-complete.sh
    ├── core-edit.ignoreeof-messages.txt
    ├── core-syntax.sh
    ├── init-bind.sh
    ├── init-cmap.sh
    ├── init-term.sh
    └── vim-surround.sh
  1. I have no knowledge of whether Homebrew has a bleh.sh recipe, and I didn't use one (see response to question 1 above).

  2. I happened to install it at /Users/$MYUSER/Code/dev-tools/bleh-0.3.0/bleh.sh, but I'm guessing this is not especially interesting information unless I was having an issue pointing to the bleh.sh file in my bashrc or bash_profile file.

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

I only mentioned that I upgraded bash via Homebrew.

Oh, I see. You have clearly written that you installed bash via Homebrew. I'm sorry it's just my mistake.

Here's the directory contents:

OK. It appears that the directory contents are correct.

Because I don't have macOS, I am trying to reproduce it in Linux with bash-3.2.57 and bash-5.0.7, but have not yet reproduced the problem. I would like to ask for your help. After the message "ble.sh: Failed to ... not defined.", can you type ble-edit/detach and hit Return/Enter?

...$ ble.sh: Failed to load the default keymap. keymap 'emacs' is not defined.
ble-edit/detach # <- Please input this text (though it will not show up).

The input command ble-edit/detach will not show up in the terminal but actually there it is. After the command, you can see the commands you input. Then I would like to know the results of the following commands. Could you provide me the results?

$ type ble-decode/DEFAULT_KEYMAP
$ declare -p _ble_decode_emacs_kmap_
$ ble/is-array _ble_decode_emacs_kmap_; echo $?

Edit: I'm also interested in the result of the following command. Can you check?

$ echo "$_ble_base_cache"
$ ls -ld "${XDG_CACHE_HOME:-$HOME/.cache}"

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

Thank you very much for details! It seems there are several separate problems. I'm still trying to reproduce the problem, yet I haven't managed to reproduce the main problem.

About results

Every time ... I get a different error message

That's a puzzle... I don't have any idea what happens there. Maybe I need to take more time to investigate it.

$ type ble-decode/DEFAULT_KEYMAP

Thank you for the result! It seems that the definition of the function ble-decode/DEFAULT_KEYMAP is successfully loaded.

$ declare -p _ble_decode_emacs_kmap_
declare -- _ble_decode_emacs_kmap_=...

Yes! Here's a problem. Somehow the expected array attribute -a is missing for the shell variable _ble_decode_emacs_kmap_. But I'm not sure for now why it's missing. The other results are understandable.

prompt_command_array error

Once thing I forgot to note is the first command post successful source always returns a ` prompt_command_array' error.

Thank you for the report! I guess you are using bash-preexec.sh, and the error is caused by the interaction of bash-preexec.sh and ble.sh. It was a separate problem related to a bug of Bash 3.2. I added a workaround (see the next section for the update).

Next check

Before going to next step, I would like to ask you to update ble-0.3. Could you try the following command to update your ble.sh? And then please restart the Bash session.

$ ble-update

The update includes

  • improved error recovery from "Failed to load the default keymap" error,
  • workaround of a Bash 3.2 bug for prompt_command_array error, and
  • a fix on a check on the availability of sleep command.

Then, after the "Failed to load the default keymap" error, could you check the results of the following commands?

$ ... $ ble.sh: Failed to load the default keymap. keymap 'emacs' is not defined.
$ grep _emacs_ "$_ble_base_cache/keymap.emacs"
$ arr=(1 2 3)
$ declare -p arr | cat -A
$ ble/util/declare-print-definitions arr | cat -A
$ cat -A <<< $IFS

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024

Thank you for the report! I guess you are using bash-preexec.sh, and the error is caused by the interaction of bash-preexec.sh and ble.sh. It was a separate problem related to a bug of Bash 3.2.

Huh, that's interesting. My impression was that it would use my updated bash version. I'm unsure if I'm using bash-preexec.sh locally - I couldn't find anything with a fuzzy search. Not sure if it matters but I have an iTerm shell integration and some bash completion scripts.

Before going to next step, I would like to ask you to update ble-0.3.

I had to install gawk via Homebrew first, but once I did so I began to run into another error when running ble-update.

$ ble-update

mkdir -p out
DEPENDENCIES_PHONY=1 DEPENDENCIES_OUTPUT=out/ble.dep DEPENDENCIES_TARGET=out/ble.sh FULLVER=0.3.0 \
	  /usr/local/bin/gawk -f ext/mwg_pp.awk ble.pp >/dev/null
mkdir -p out/keymap
cp -p keymap/emacs.sh out/keymap/emacs.sh
cp -p keymap/vi.sh out/keymap/vi.sh
cp -p keymap/vi_digraph.sh out/keymap/vi_digraph.sh
cp -p keymap/vi_digraph.txt out/keymap/vi_digraph.txt
cp -p keymap/vi_test.sh out/keymap/vi_test.sh
cp -p keymap/emacs.rlfunc.txt out/keymap/emacs.rlfunc.txt
cp -p keymap/vi_imap.rlfunc.txt out/keymap/vi_imap.rlfunc.txt
cp -p keymap/vi_nmap.rlfunc.txt out/keymap/vi_nmap.rlfunc.txt
mkdir -p out/lib
cp -p lib/init-term.sh out/lib/init-term.sh
cp -p lib/init-bind.sh out/lib/init-bind.sh
cp -p lib/core-complete.sh out/lib/core-complete.sh
/usr/local/bin/gawk -f ext/mwg_pp.awk lib/core-syntax.sh > out/lib/core-syntax.sh
cp -p lib/core-edit.ignoreeof-messages.txt out/lib/core-edit.ignoreeof-messages.txt
cp -p lib/init-cmap.sh out/lib/init-cmap.sh
cp -p lib/vim-surround.sh out/lib/vim-surround.sh
bash make_command.sh install "out/ble.sh" "/Users/dbarnard/Code/dev-tools/ble-0.3.0/ble.sh"
sed: 1: "1i# this script is a pa ...": command i expects \ followed by text
make: *** [/Users/dbarnard/Code/dev-tools/ble-0.3.0/ble.sh] Error 1
[ble: exit 2]

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

I'm sorry for many troubles one after another. As I haven't tested ble.sh with macOS, there seem to be many troubles related to the differences between softwares, such as GNU awk vs new-awk, GNU sed vs BSD sed, etc. I fixed the problem of the update. Also I newly installed FreeBSD (which I think is closer to macOS environment than Linux) in my virtual machine, tested ble.sh, and fixed another problem.

I'm sorry, but I think ble-update is currently not available in your bash due to the installation failure. Could you try to update ble.sh by the following command?

$ cd /Users/dbarnard/Code/dev-tools/ble-0.3.0/ble.sh/src/ble.sh
$ git pull
$ make clean
$ make install INSDIR=../..

Then, if there is no problem, could you try the following commands (which were modified from the previous comment) in the new session?

$ ... $ ble.sh: Failed to load the default keymap. keymap 'emacs' is not defined.
$ grep _emacs_ "$_ble_base_cache/keymap.emacs"
$ arr=(1 2 3)
$ declare -p arr | cat -v
$ ble/util/declare-print-definitions arr | cat -v
$ cat -v <<< $IFS

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

My impression was that it would use my updated bash version

Maybe you haven't yet noticed, but actually you are still using Bash 3.2.57 for login shells as your first post implies:

$ bash -c 'echo $BASH_VERSION' 
5.0.11(1)-release # <-- this is the version of Bash called from login shells
$ echo $BASH_VERSION
3.2.57(1)-release # <-- this is the version of Bash for login shells

So actually you can now switch to newly installed Bash to see if the problem persists, but to avoid the complication of the problem I would like to solve the problem in older Bash before going to the newer version.

I'm unsure if I'm using bash-preexec.sh locally .... I have an iTerm shell integration

I found that in fact iTerm2 shell-integration script contains embedded bash-preexec.sh.

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024

No worries at all - thanks for being so responsive on the issue.

Well I couldn't follow your instructions exactly, but the good news is that's because I no longer receive the "Failed to load the default keymap" type error. I ran the commands in case the output was still useful.

$ grep _emacs_ "$_ble_base_cache/keymap.emacs"
_ble_decode_emacs_kmap_=([0]="1:ble/widget/set-mark" [8]="1:ble/widget/delete-region-or backward-char" [9]="1:ble/widget/complete" [13]="1:ble/widget/accept-single-line-or-newline" [32]="1:ble/widget/magic-space" [45]="1:ble/widget/emacs/append-arg" [48]="1:ble/widget/emacs/append-arg" [49]="1:ble/widget/emacs/append-arg" [50]="1:ble/widget/emacs/append-arg" [51]="1:ble/widget/emacs/append-arg" [52]="1:ble/widget/emacs/append-arg" [53]="1:ble/widget/emacs/append-arg" [54]="1:ble/widget/emacs/append-arg" [55]="1:ble/widget/emacs/append-arg" [56]="1:ble/widget/emacs/append-arg" [57]="1:ble/widget/emacs/append-arg" [127]="1:ble/widget/delete-region-or backward-char" [1114112]="1:ble/widget/batch-insert" [1114113]="1:ble/widget/self-insert" [1114115]="1:ble/widget/emacs/__before_widget__" [1114116]="1:ble/widget/emacs/__after_widget__" [1114117]="1:ble/widget/safe/__attach__" [1114126]="1:ble/widget/overwrite-mode" [1114127]="1:ble/widget/@nomarked beginning-of-line" [1114129]="1:ble/widget/delete-region-or forward-char" [1114130]="1:ble/widget/@nomarked end-of-line" [1114132]="1:ble/widget/command-help" [1114152]="1:ble/widget/emacs/bracketed-paste" [1114154]="1:ble/widget/@nomarked backward-line history" [1114155]="1:ble/widget/@nomarked forward-line history" [1114156]="1:ble/widget/@nomarked forward-char" [1114157]="1:ble/widget/@nomarked backward-char" [1114159]="1:ble/widget/auto-complete-enter" [34668559]="1:ble/widget/@marked beginning-of-line" [34668562]="1:ble/widget/@marked end-of-line" [34668586]="1:ble/widget/@marked backward-line" [34668587]="1:ble/widget/@marked forward-line" [34668588]="1:ble/widget/@marked forward-char" [34668589]="1:ble/widget/@marked backward-char" [67108872]="1:ble/widget/emacs/undo" [67108873]="1:ble/widget/menu-complete" [67108877]="1:ble/widget/accept-line" [67108896]="1:ble/widget/set-mark" [67108909]="1:ble/widget/emacs/append-arg" [67108911]="1:ble/widget/emacs/undo" [67108912]="1:ble/widget/emacs/append-arg" [67108913]="1:ble/widget/emacs/append-arg" [67108914]="1:ble/widget/emacs/append-arg" [67108915]="1:ble/widget/emacs/append-arg" [67108916]="1:ble/widget/emacs/append-arg" [67108917]="1:ble/widget/emacs/append-arg" [67108918]="1:ble/widget/emacs/append-arg" [67108919]="1:ble/widget/emacs/append-arg" [67108920]="1:ble/widget/emacs/append-arg" [67108921]="1:ble/widget/emacs/append-arg" [67108927]="1:ble/widget/delete-region-or backward-char" [67108928]="1:ble/widget/set-mark" [67108956]="1:ble/widget/bell" [67108957]="1:ble/widget/bell" [67108958]="1:ble/widget/bell" [67108959]="1:ble/widget/emacs/undo" [67108961]="1:ble/widget/@nomarked beginning-of-line" [67108962]="1:ble/widget/@nomarked backward-char" [67108963]="1:ble/widget/discard-line" [67108964]="1:ble/widget/delete-region-or forward-char-or-exit" [67108965]="1:ble/widget/@nomarked end-of-line" [67108966]="1:ble/widget/@nomarked forward-char" [67108967]="1:ble/widget/bell" [67108968]="1:ble/widget/delete-region-or backward-char" [67108969]="1:ble/widget/complete" [67108970]="1:ble/widget/accept-line" [67108971]="1:ble/widget/kill-forward-line" [67108972]="1:ble/widget/clear-screen" [67108973]="1:ble/widget/accept-single-line-or-newline" [67108974]="1:ble/widget/@nomarked forward-line history" [67108975]="1:ble/widget/accept-and-next" [67108976]="1:ble/widget/@nomarked backward-line history" [67108977]="1:ble/widget/emacs/quoted-insert" [67108978]="1:ble/widget/history-isearch-backward" [67108979]="1:ble/widget/history-isearch-forward" [67108980]="1:ble/widget/transpose-chars" [67108981]="1:ble/widget/kill-backward-line" [67108982]="1:ble/widget/emacs/quoted-insert" [67108983]="1:ble/widget/kill-region-or uword" [67108984]="_" [67108985]="1:ble/widget/yank" [67108986]="1:ble/widget/.SHELL_COMMAND 'fg'" [67108991]="1:ble/widget/emacs/undo" [68222991]="1:ble/widget/@nomarked beginning-of-text" [68222992]="1:ble/widget/history-beginning" [68222993]="1:ble/widget/delete-forward-cword" [68222994]="1:ble/widget/@nomarked end-of-text" [68222995]="1:ble/widget/history-end" [68223020]="1:ble/widget/@nomarked forward-cword" [68223021]="1:ble/widget/@nomarked backward-cword" [100663393]="1:ble/widget/@marked beginning-of-line" [100663394]="1:ble/widget/@marked backward-char" [100663397]="1:ble/widget/@marked end-of-line" [100663398]="1:ble/widget/@marked forward-char" [100663406]="1:ble/widget/@marked forward-line" [100663408]="1:ble/widget/@marked backward-line" [101777423]="1:ble/widget/@marked beginning-of-text" [101777426]="1:ble/widget/@marked end-of-text" [101777452]="1:ble/widget/@marked forward-cword" [101777453]="1:ble/widget/@marked backward-cword" [134217736]="1:ble/widget/copy-backward-sword" [134217741]="1:ble/widget/newline" [134217760]="1:ble/widget/set-mark" [134217761]="1:ble/widget/complete context=command" [134217764]="1:ble/widget/complete context=variable" [134217767]="1:ble/widget/sabbrev-expand" [134217770]="1:ble/widget/complete insert_all" [134217773]="1:ble/widget/emacs/append-arg" [134217775]="1:ble/widget/complete context=filename" [134217776]="1:ble/widget/emacs/append-arg" [134217777]="1:ble/widget/emacs/append-arg" [134217778]="1:ble/widget/emacs/append-arg" [134217779]="1:ble/widget/emacs/append-arg" [134217780]="1:ble/widget/emacs/append-arg" [134217781]="1:ble/widget/emacs/append-arg" [134217782]="1:ble/widget/emacs/append-arg" [134217783]="1:ble/widget/emacs/append-arg" [134217784]="1:ble/widget/emacs/append-arg" [134217785]="1:ble/widget/emacs/append-arg" [134217788]="1:ble/widget/history-beginning" [134217790]="1:ble/widget/history-end" [134217791]="1:ble/widget/complete show_menu" [134217792]="1:ble/widget/complete context=hostname" [134217794]="1:ble/widget/@marked backward-cword" [134217798]="1:ble/widget/@marked forward-cword" [134217805]="1:ble/widget/@marked non-space-beginning-of-line" [134217820]="1:ble/widget/delete-horizontal-space" [134217822]="1:ble/widget/history-expand-line" [134217826]="1:ble/widget/@nomarked backward-cword" [134217828]="1:ble/widget/kill-forward-cword" [134217830]="1:ble/widget/@nomarked forward-cword" [134217831]="1:ble/widget/complete context=glob" [134217832]="1:ble/widget/kill-backward-cword" [134217836]="1:ble/widget/redraw-line" [134217837]="1:ble/widget/@nomarked non-space-beginning-of-line" [134217842]="1:ble/widget/emacs/revert" [134217847]="1:ble/widget/copy-region-or uword" [134217850]="1:ble/widget/.SHELL_COMMAND 'fg'" [134217854]="1:ble/widget/complete context=username" [134217855]="1:ble/widget/copy-backward-sword" [135331857]="1:ble/widget/copy-forward-sword" [135331884]="1:ble/widget/@nomarked forward-sword" [135331885]="1:ble/widget/@nomarked backward-sword" [167772258]="1:ble/widget/@marked backward-cword" [167772262]="1:ble/widget/@marked forward-cword" [167772269]="1:ble/widget/@marked non-space-beginning-of-line" [168886316]="1:ble/widget/@marked forward-sword" [168886317]="1:ble/widget/@marked backward-sword" [201326655]="1:ble/widget/copy-backward-sword" [201326695]="1:ble/widget/bell" [201326696]="1:ble/widget/copy-backward-sword" [201326701]="1:ble/widget/newline")
_ble_decode_emacs_kmap__67108984=([33]="1:ble/widget/complete show_menu:context=command" [36]="1:ble/widget/complete show_menu:context=variable" [39]="1:ble/widget/sabbrev-expand" [42]="1:ble/widget/complete insert_all:context=glob" [47]="1:ble/widget/complete show_menu:context=filename" [60]="1:ble/widget/history-nsearch-backward" [62]="1:ble/widget/history-nsearch-forward" [64]="1:ble/widget/complete show_menu:context=hostname" [85]="1:ble/widget/emacs/redo" [103]="1:ble/widget/complete show_menu:context=glob" [110]="1:ble/widget/history-substring-search-forward" [112]="1:ble/widget/history-substring-search-backward" [117]="1:ble/widget/emacs/undo" [126]="1:ble/widget/complete show_menu:context=username" [1114154]="1:ble/widget/history-search-backward" [1114155]="1:ble/widget/history-search-forward" [67108967]="1:ble/widget/bell" [67108974]="1:ble/widget/history-search-forward" [67108976]="1:ble/widget/history-search-backward" [67108978]="1:ble/widget/dabbrev-expand" [67108981]="1:ble/widget/emacs/undo" [67108982]="1:ble/widget/display-shell-version" [67108984]="1:ble/widget/exchange-point-and-mark" [100663413]="1:ble/widget/emacs/redo")
$ arr=(1 2 3)
$ declare -p arr | cat -v
declare -a arr='([0]="1" [1]="2" [2]="3")'
$ ble/util/declare-print-definitions arr | cat -v
arr=([0]="1" [1]="2" [2]="3")
$ cat -v <<< $IFS
# blank new line

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024

Maybe you haven't yet noticed, but actually you are still using Bash 3.2.57 for login shells as your first post implies:

Hm, yes I thought the default shell in OSX was the login shell so I'm actually not sure why there's two versions for different shells, but I don't know much about this type of stuff. https://unix.stackexchange.com/questions/119627/why-are-interactive-shells-on-osx-login-shells-by-default

So actually you can now switch to newly installed Bash to see if the problem persists, but to avoid the complication of the problem I would like to solve the problem in older Bash before going to the newer version.

The main feature that drew me to this project was the mention of fish / zsh-autosuggestions type functionality but in plain bash. Here's an example of what I mean.

776722e0

Is the reason I'm not seeing these types of autosuggestions for all terminal commands because bleh.sh is running on an older version of bash for the login shell? If so I'm guessing I should change my login shell bash version by adding bleh.sh to /etc/shells.

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

For "Failed to load the default keymap" error

Thank you for the results!

the good news is that's because I no longer receive the "Failed to load the default keymap" type error.

OK. So now, would you have some syntax highlighting? (If not, that means there are still problems.)

$ grep _emacs_ "$_ble_base_cache/keymap.emacs"
_ble_decode_emacs_kmap_=([0]="1:ble/widget/set-mark"...
_ble_decode_emacs_kmap__67108984=([33]="1:ble/widget...
$ arr=(1 2 3)
$ declare -p arr | cat -v
declare -a arr='([0]="1" [1]="2" [2]="3")'
$ ble/util/declare-print-definitions arr | cat -v
arr=([0]="1" [1]="2" [2]="3")
$ cat -v <<< $IFS
# blank new line

Now it looks like everything is working correctly. I'm not sure what was the actual problem, but I am thinking of leaving it for another occasion.

Is the reason I'm not seeing these types of autosuggestions for all terminal commands because bleh.sh is running on an older version of bash?

Yes. ble.sh's autosuggestions are only available with Bash 4.0 and later because it internally uses a Bash 4.0's feature. Currently your login shell is Bash 3.2, so autosuggestions are inactive.

Change login shell

Let's go to the newer version of Bash! I don't know your exact situation, but I guess you have installed the new Bash by Homebrew but haven't added the path in /etc/shells and also haven't changed the default shell by chsh command. In order to use the new version of Bash as the default login shell, you want to follow this Q&A. To summarize the instructions, you need the following two steps:

  1. Add a line /usr/local/bin/bash (the path to the new version of Bash) to /etc/shells (you need a root privilege to edit the file). Edit: Before adding it to /etc/shells, please check that the path is actually /usr/local/bin/bash. If the path is incorrect, it will cause problems.
  2. Change your default login shell to the new version by the command chsh -s /usr/local/bin/bash.

FYI: Right prompt in ble.sh

If you want to show the right prompt (like RPROMPT in zsh) as in the image of your previous comment, ble.sh provides the setting. You can use the following setting if you are interested.

# In ~/.bashrc (after source ble.sh) or in ~/.blerc
bleopt rps1='\D{%c}'

Here is an example at my side (in Arch Linux in a virtual machine). I'm running Bash 5.0:

Example
image

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

FYI: .bash_profile vs .bashrc

Related to the login shell, you have mentioned that you are using .bash_profile to configure ble.sh in the initial post:

I add follow the instructions for configuring bleh.sh with .bashrc (except that I'm using .bash_profile)

If you do not have specific reasons or special preferences, I actually recommend you to put the setting of ble.sh in .bashrc but not in .bash_profile. (I'm sorry if you already understand that and do it in that way intendedly!)

Login shell and non-login shell

Actually .bash_profile is loaded for the login shells, and .bashrc is loaded for the other shells (instead of .bash_profile). For example when you open a terminal in macOS, you'll initially get a login shell:

$ echo hello # <-- We are in a login shell (bash_login is loaded for this session).
hello
$
$ bash # <-- You can launch a child shell inside the login shell.
$ echo hello # <-- Now we are NOT in a login shell but a child shell (bashrc is loaded for this session)
hello
$ exit # <-- Exit the child shell.
$ # <-- We come back to the login shell

Normal configuration

Usually .bash_profile is configured to call .bashrc inside. In this way, .bash_profile is called only once in the login shell for the session, and .bashrc is called every time the new Bash starts. In such a setup, .bash_profile is used to configure the settings that affects all the child processes (such as environment variables), and .bashrc is used to configure the settings which have effects to only the current Bash (such as aliases, functoins, key bindings, Bash extensions, etc.). The typical configuration of .bash_profile and .bashrc have the following forms:

# bash_profile

# (Setting environment variables such as LANG, PATH, etc.)

# call bashrc inside
[[ -f ~/.bashrc ]] && source ~/.bashrc
# bashrc

# (Common settings)

[[ $- == *i* ]] || return 0 # If this is not interactive session, then exit here

# (Commonn settings for interactive session such as aliases, functions, key bindings, etc)

ble.sh in bashrc

Actually ble.sh belongs to the latter type of configuration, i.e., it only affects the current Bash instance. So we want to call ble.sh in .bashrc to load ble.sh for every Bash instances. If you configure ble.sh in .bash_profile, you have ble.sh only in login shells and will not get ble.sh activated in non-login shells. You can confirm that by launching another non-login bash inside the login bash.

For this reason, I recommend to configure ble.sh in .bashrc. (In such a case, please do not forget to call .bashrc from .bash_profile!)

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024

Now it looks like everything is working correctly. I'm not sure what was the actual problem, but I am thinking of leaving it for another occasion.

Should have mentioned that I did run the update command successfully first before the errors loading ble.sh stopped.

If you want to show the right prompt (like RPROMPT in zsh) as in the image of your previous comment, ble.sh provides the setting.

Ah, sorry I wasn't clear! I showed the screenshot from fish as an example of autocomplete since I wasn't sure if the ble.sh autcomplete feature was similar to the fish version or not.

Thanks for the detailed information on login shells! I followed the instructions and now have fish-like autocomplete working which I'm very happy about. There are two small issues I'm running into though.

The suggested contents can be inserted by typing S-RET (when the cursor is at the end of the command line, you can also use right, C-f or end to insert the suggestion).

  1. S-RET: I was unfamiliar with emac keyboard notation (so I think it refers to "Shift + Return") but I'm not sure what the intended behavior is for S-RET? I was hoping it would behave like right or C-f, but on my system it only behaves like "Return". I think there may be a limitation in iTerm2 and maybe OSX where by default S-RET has the same keycode as RET https://emacs.stackexchange.com/questions/26699/keycode-for-shift-return-on-os-x-iterm2. I can configure a hex or escape code to return on S-RET but I'm not sure what it should be, or if that's the right approach.

If you want to insert only first word of the suggested contents, you can use M-right or M-f

  1. M-right: Even though I have to the Option key set as a Meta key as suggested here in iTerm2, M-right is interpreted as right. I'm not sure if it's relevant and I can't find much documentation on it, but I have an iTerm2 setting called Natural Text Editing that allows Opt-right to move one word on the terminal. I can use Tab to select the first path section in a longer path, which is good, but it sounds different from what M-right does.

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

I followed the instructions and now have fish-like autocomplete working which I'm very happy about.

Thank you for the report! I'm glad to hear that!

1. S-RET

S-RET: I was unfamiliar with emac keyboard notation (so I think it refers to "Shift + Return")

Right. It represents "Shift + Return".

I was hoping it would behave like right or C-f, but on my system it only behaves like "Return".

Yes. S-RET is intended to behave like right or C-f. To be precise, when the cursor is not at the end of the line, right and C-f retain the original meaning, "move one character right", so they cannot be used for auto-complete. S-RET is an alternative binding which can be used for auto-complete any time.

but on my system it only behaves like "Return". I think there may be a limitation in iTerm2 and maybe OSX

This should be the limitation of iTerm2. ble.sh uses a terminal feature for extended key sequences called "modifyOtherKeys", but it seems iTerm2 haven't yet supported it according to my search. There was a pull request for extended key settings in iTerm2 three years ago. The author of iTerm2 opened an Issue for modifyOtherKeys at that time. Recently the author again opened another Issue for modifyOtherKeys. Maybe it will be supported in near future.

I can configure a hex or escape code to return on S-RET but I'm not sure what it should be, or if that's the right approach.

I think that's the right approach for the current iTerm2. I don't have macOS, so I cannot try iTerm2, but it seems there is a setting "Action: Send Escape Sequence" looking at an image in this answer. You can enter [13;2u in the bottom text box (next to "ESC +") for S-RET.

If you also want to set up other key combinations for iTerm2, the following table shows examples for the key combinations used in ble.sh.

Key combination Escape sequence Key combination Escape sequence
S-RET ESC [ 1 3 ; 2 u C-0 ESC [ 4 8 ; 5 u
C-RET ESC [ 1 3 ; 5 u C-1 ESC [ 4 9 ; 5 u
C-S-RET ESC [ 1 3 ; 6 u C-2 ESC [ 5 0 ; 5 u
S-TAB ESC [ 9 ; 2 u C-3 ESC [ 5 1 ; 5 u
C-TAB ESC [ 9 ; 5 u C-4 ESC [ 5 2 ; 5 u
C-S-TAB ESC [ 9 ; 6 u C-5 ESC [ 5 3 ; 5 u
S-SP ESC [ 3 2 ; 2 u C-6 ESC [ 5 4 ; 5 u
C-S-SP ESC [ 3 2 ; 6 u C-7 ESC [ 5 5 ; 5 u
S-BS ESC [ 8 ; 2 u C-8 ESC [ 5 6 ; 5 u
C-S-BS ESC [ 8 ; 6 u C-9 ESC [ 5 7 ; 5 u

2. M-right

I think the right settings depend on what behavior you actually expect for different key combinations with Meta keys. There are historically two different roles for Meta key in terminals:

  • Meta character: One is to send a meta character (such as alphabets with accents, etc. depending on your settings of language, e.g., Á with "Meta + A"),
  • Meta modifier: The other is to send an escape sequence which represents a modifier "Meta" (M- in Emacs notation).

The following is a part of possible settings based on my guess on iTerm2 (as I don't have iTerm2/macOS). I'm not sure if they work, but I wish so.

  • Option 1 (Always Meta modifier): If you want to always send M-something with all the keys combined with Meta key, you can select "Esc+" for "Left/Right ⌥ Key" as in the image in this answer.

  • Option 2 (Meta modifier only for function keys): This is the setting for the case you want to normally send meta characters for "Meta + character (such as alphabets/numbers/delimiters)", and only send escape sequences for "Meta + function (such as left/up/home/pagedown/delete, etc.)". I'm not sure if this is possible for iTerm2, but I guess "Natural Text Editing" does that (though I couldn't find any detailed documentation what "Natural Text Editing" does actually). If that's the case, please turn on "Natural Text Editing" and also please turn the "Left/Right ⌥ Key" settings back to "Normal". If this setting does not work, please use the following Option 3.

  • Option 3 (Meta modifier for specified keys): If you want to send meta characters by default and want to one-by-one specify special key combinations that should send meta modifier, you can use the same approach with the above S-RET. Specifically for M-right, you can follow this answer. The answer describes the setting to let Meta + left/right send M-b/M-f to terminal applications. In this case please set the "Left/Right ⌥ Key" setting to "Normal" or "Meta".

  • Option 4 (Meta character for "Left ⌥" and Meta modifier for "Right ⌥"): You can also assign different roles to "Left/Right ⌥". For example, if you want to send meta characters for "Left ⌥" and meta modifiers for "Right ⌥", please set "Left ⌥ Key" to be "Meta" and "Right ⌥ Key" to "Esc+".

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

OK. Thank you for your reports and replies on the problems!

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024

Just letting you know that including bleopt complete_auto_wordbreaks=$' \t\n/' in my .blerc file causes this error to display when loading bleh.sh. It also appears as if the change does not take affect. I ran ble-update to grab the latest as well.

bleopt: unknown bleopt option `complete_auto_wordbreaks'

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

Thank you for the information! Which version of ble.sh do you use? As I have already written, this new feature is implemented in the master branch and not reflected in ble-0.3. In my environment, it works for the master branch. If you now use ble-0.3 and want to use the feature, you need to switch to the master branch (the devel branch for ble-0.4). To use the master branch version, you can follow the intruction in README (with git clone & make install).

Note: ble-update does not upgrade ble-0.3 series to ble-0.4 series. It just picks up patches for fixing problems in ble-0.3.

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

Thank you for the report! This was a bug. Fixed (db8b0c2). Could you check after ble-update?

from ble.sh.

dylankb avatar dylankb commented on May 20, 2024

Yep, that fixed it!

from ble.sh.

akinomyoga avatar akinomyoga commented on May 20, 2024

Thank you!

from ble.sh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.