When I start emacs from the terminal, where I have zsh with PATH defined also to ~/.local/bin, my elisp macro - calling a program localted in ~/.local/bin - works. When I start emacs by a keyboard shortcut, the program is not found
Assistant
This is a common issue where GUI applications don't inherit the same environment variables as your terminal shell. When you launch emacs from the terminal, it gets your zsh environment including the PATH with ~/.local/bin. But when launched via keyboard shortcut, it uses the system's default PATH.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Option 3: Set environment variables for GUI sessions
Create or edit ~/.xprofile (or ~/.xsessionrc on some systems):
export PATH="$HOME/.local/bin:$PATH"
Then log out and back in.
Option 4: Modify the desktop launcher
If you're using a specific desktop entry, you can modify it to source your shell environment first. Find the .desktop file and change the Exec line to something like:
Exec=zsh -c "source ~/.zshrc && emacs"
The first option with exec-path-from-shell is usually the most reliable and emacs-native solution.