Giter Club home page Giter Club logo

eless's People

Contributors

alphapapa avatar iqbalansari avatar kaushalmodi avatar lesliesrussell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

eless's Issues

man pages are not readable on macOS

(This top portion is edited by @kaushalmodi)

Workaround

Due to the way man handles the man page caching and streaming on macOS systems, PAGER=eless man ls does not work there.

But PAGER=less man ls | eless works! See #27 (comment) for details.

(The original post now follows below.)


Mentioned this issue in #18.

 rob  ~/b/eless   master ±  echo $PAGER
eless
 rob  ~/b/eless   master ±  man ls | eless -D
Eless Version c447784 (commit hash of current master~1)
https://github.com/kaushalmodi/eless/tree/master
DEBUG: --> Input from pipe/file
DEBUG:     Output to terminal -->
DEBUG: var : -D
DEBUG: Raw Args                       : -D
DEBUG: Emacs Args                     : -nw
DEBUG: Pipe Contents (up to 10 lines) : This script is not supposed to send output to a pipe
DEBUG: Temp File : /var/folders/24/18pqhyd57wv1c4cn4r7zswt40000gn/T/emacs-stdin-rob.NyrJ0jY
DEBUG: first_line_piped_data = This script is not supposed to send output to a pipe
DEBUG: No man page or info manual detected
DEBUG: Eless Command : emacs_Q_view_mode /var/folders/24/18pqhyd57wv1c4cn4r7zswt40000gn/T/emacs-stdin-rob.NyrJ0jY                          -nw                          --eval '(progn
                                   (set-visited-file-name nil)
                                   (rename-buffer "*Stdin*" :unique))'
DEBUG: Args passed to emacs_Q_view_mode : /var/folders/24/18pqhyd57wv1c4cn4r7zswt40000gn/T/emacs-stdin-rob.NyrJ0jY -nw --eval (progn
                                   (set-visited-file-name nil)
                                   (rename-buffer "*Stdin*" :unique))

This script is not supposed to send output to a pipe displayed in eless.

 rob  ~/b/eless   master ± 

Installation instructions

I cannot find any installation instructions in the documentation for eless. I eventually just cloned the repository and linked the eless script into my PATH (although the Info page is still not installed), but I'd rather this were spelled out so I didn't have to think about it. Or if there were a Homebrew formula for eless, that would solve the problem as well.

Output the contents of the buffer, when connected to a pipe

Just a thought perhaps eless can output the current buffer, when its output is pipe, this way it can part of a larger pipeline.

The use case I am thinking of is using eless, as an interactive replacement for likes of sed or awk allowing user to transform the text before it goes to next thing in the pipeline.

Don't prompt to save buffer if in view-mode

If view-mode is enabled, user could have used functions like keep-lines. The purpose is usually to filter out lines when reviewing log files.

So at the time if quitting, if view-mode is in enabled state, but the buffer is modified, ignore that and don't prompt the user to save anything.

On the other hand, if the view-mode is off and the buffer is modified, prompt to save as usual.

Make eless run on emacs 22.1

Given that this is a shell command, I would not rely on users:

  1. Being Emacs users
  2. Having a modern version of emacs on their system or one named "emacs" in their path

In my case OS X ships with Emacs 22, which does not support these functions (I think only versions greater that 24.4 do?).

I think eval-after-load and string-match would suffice.

Also, I usually download Emacs from here. In this case there is no binary called emacs. It's called Emacs.

Cleanup Temp File Via trap

I had issues RE #18. When investigating I noticed that the cleanup assumes the script will reach the end. Even without #18 this isn't always the case, i.e., signals. You should so this instead:

trap 'cleanup' 'EXIT'

cleanup() {
    # do cleanup stuff
}

# other code here...

Though I'd also stuff that into the temp directory.

Note that I would have sent a PR, but the instructions for building lead me to believe that this simple PR could turn into a time-consuming endeavor. I see #16 😉

Not able to pipe into eless

OS: MacOS 10.12.6
Shell: fish 2.5.0/bash 4.4.0(1)-release

 rob  ~/b/eless   master ±  ls
CONTRIBUTING.org README.org       doc              eless.org
LICENSE.md       build            eless
 rob  ~/b/eless   master ±  emacs --version
GNU Emacs 25.3.1
Copyright (C) 2017 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
 rob  ~/b/eless   master ±  echo 'test' | ./eless -D
Eless Version f2eee31 (commit hash of current master~1)
https://github.com/kaushalmodi/eless/tree/master
DEBUG: --> Input from pipe/file
DEBUG:     Output to terminal -->
DEBUG: var : -D
DEBUG: Raw Args                       : -D
DEBUG: Emacs Args                     : -nw
DEBUG: Pipe Contents (up to 10 lines) : test
DEBUG: Temp File : emacs-stdin-rob.HJxNpaJ
--tmpdir
DEBUG: first_line_piped_data = test
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]
DEBUG: No man page or info manual detected
DEBUG: Eless Command : emacs_Q_view_mode emacs-stdin-rob.HJxNpaJ
--tmpdir                          -nw                          --eval '(progn
                                   (set-visited-file-name nil)
                                   (rename-buffer "*Stdin*" :unique))'
DEBUG: Args passed to emacs_Q_view_mode : emacs-stdin-rob.HJxNpaJ

A GUI emacs opens without anything in it.

 rob  ~/b/eless   master ±  ls
--tmpdir                         build                            emacs-stdin-rob.HJxNpaJ
CONTRIBUTING.org                 doc                              emacs-stdin-rob.HJxNpaJ?--tmpdir
LICENSE.md                       eless
README.org                       eless.org

Auto-detect ANSI codes

Parse the first few lines (may be 10?) to see if the file contains ANSI codes. If found, call the ansi-color-apply-on-region .

Probably remove the -ansi switch after that?

Add option to open info manuals

Idea is to have an option like --info.

So if one does eless --info emacs, it opens the Emacs Info Manual in eless. The argument after --info could be any Info manual available on the system.

Eventually should be able to alias info to eless --info.

How can I use eless in vterm?

It would be nice to configure the way that eless invokes emacs -- for instance, I want to use it in vterm and open in the current emacs frame.

Customize faces

Using elesss would be less jarring if it followed the custom-set-faces in my custom-file.

Error when filename has parentheses

When loading a file and the filename has parentheses eless breaks with an error.

echo "no content" > "filename with (parentheses)".txt
LANGUAGE=C eless filename\ with\ \(parentheses\).txt

Result:

/usr/bin/eless: eval: line 684: syntax error near unexpected token `('

eless is

eless_version='v0.6'
eless_git_hash='1a21b4b'

Auto-detect unified diff output too

Let's say we have these files a and b.

echo a > a
echo b > b

At present, diff-mode is auto-enabled in this case:

diff a b | eless

Output:

1c1
< a
---
> b

But the Unified Diff is not auto-detected:

diff -u a b | eless

Output:

--- a   2017-05-11 22:07:28.141078000 -0400
+++ b   2017-05-11 22:07:32.559028000 -0400
@@ -1 +1 @@
-a
+b

Don't use grep -P

Copied #18 (comment) by @sshaw below verbatim:


If adaptation is a goal, I would not require GNU grep and would use an alternate approach.
It seems as though you're using -P just for regex lookahead.

There are alternatives (untested 😄):

grep -o '^([A-Za-z-_]+\([0-9]+\))(?=\s+.*?\1$)' 

Can be:

grep '^\([A-Za-z_-]+([0-9]+)\) \+.*\1$'  | grep -o '^[A-Za-z_-]\+([0-9]\+)'

Or instead of using Perl regexes (-P), just use perl:

perl -ne'/^([A-Za-z-_]+\([0-9]+\))(?=\s+.*?\1$)/ and print'

It's likely already installed and I'm pretty sure it's installed by default more than GNU grep.

Also if you use egrep then you don't have to escape any of ()+.


Fix building using "make all" on macOS

@sshaw

The "eless build requirements" are higher than "eless run requirements".

For future plans like auto-publishing eless documentation site using ox-hugo, the minimum requirement for building eless script and documentation is emacs 24.4.. Couple of reasons:

  • I use Org master (9.2.x), but can make sure that builds work fine on latest Org stable (9.1.x) too.. Minimum requirement for Org 9.1.x is emacs 24.4. So not worth trying to make the build process work on older emacs/Org versions.
  • In the ox-hugo build setup, I use advice-add which got added in emacs 24.4.

From your comment in other thread:

make all EMACS=Emacs

 /tmp/eless >make all EMACS=Emacs
 Emacs binary used: Emacs
 Loading /tmp/eless/build/setup-eless.el (source)...
 Emacs is now refreshing its package database...
 Importing package-keyring.gpg...
 Importing package-keyring.gpg...done
 Contacting host: orgmode.org:443
 Failed to download ‘org’ archive.
 Failed to download ‘melpa’ archive.
 Package refresh done
 Installing ‘org-plus-contrib’ ..
 Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
 Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
 Package ‘org-plus-contrib-’ is unavailable
 make: *** [vcheck] Error 255

What emacs version was that?

The failure seems odd that it failed in the package download step itself.. http/https issues?

Let's first get make vcheck working on your system, emacs 24.4 or newer.

Suggestion: cleaner debug code

Hi again,

Just a suggestion you might want to consider. There's a really cool technique for Bash scripts, which I've seen called a "collapsing function." It's especially useful for optional debug output. Here's an example:

function debug {
    # A collapsing function. Cool.
    if [[ $debug ]]
    then
        function debug {
            echo -e "${COLOR_YELLOW}DEBUG: ${@}${COLOR_OFF}" >&2
        }
        debug "$@"
    else
        function debug {
            true
        }
    fi
}

Then to send debug output, you just do:

debug "Something"

instead of having to do:

if [[ $debug ]]
then
  echo something >&2
fi

And by redefining or "collapsing" the function, it avoids the tests when debugging is disabled (though I doubt it matters in a shell script).

`make install` fails without meaningful error message if makeinfo is not installed

(Thanks for eless!)

Processing Texinfo file /home/tobias.rittweiler/Srcs/open-source/eless.git/docs/eless.texi...
File "/home/tobias.rittweiler/Srcs/open-source/eless.git/docs/eless.info" wasn’t produced.  See "*Org INFO Texinfo Output*" for details
make: *** [Makefile:58: emacs_batch] Error 255

When not running emacs in batch mode and looking into the mentioned buffer, one can discover that the makeinfo command is missing.

Suggestions:

  1. Add texinfo under Requirements.
  2. Check explicitly for the presence of makeinfo and fail with a meaningful error message.

Default theme

Hey, let's talk about the current theme.

I like the new (9448563) Man-overstrike color but I don't think it meshes well with man links. In my opinion (by using this site: http://paletton.com/#uid=51v0u0kkOuvb3MlgsBnparKsemh), I think #F3C355 would be a well suited color. I also think that talking about the default menu bar colors would be worth a discussion.

I tried to add this myself with a pull request but for some reason it wouldn't recognize me setting the face.

Thoughts?

View multiple files in sequence with eless

When running e.g.

$ eless *.patch

I would like to be able to inspect the first file as usual, then press some key to proceed to the next file, and so on until all the files are processed. (This is what emacsclient does, and the keybinding is C-x #.) Is there an equivalent way to do this in eless?

Reconsider emacs dependency for brew formula

I have a separate emacs installation and don't want to use brew's installation; I wonder how common that is and whether emacs should be a required dependency in the formula.

man page with colors

Hello great job, I have this issue when man pages contains colors

PAGER=less man argv 

img-2019-07-30-194346

PAGER=eless man argv 

img-2019-07-30-194328

Thanks

Don't hard-code the indentation in source blocks

Don't do this:

Input is piped from =man= command
#+BEGIN_SRC shell
        if [[ ! -z ${man_page} ]]
        then
            # After setting PAGER variable to eless, try something like `man grep'.
            # That will launch the man page in eless.

Possible solutions:

  • Insert all such blocks using noweb refs
  • Do not split such if/else blocks across source blocks
  • Auto-indent the whole eless script post-tangling

passing updated man page

hi. eless is very nice. so, i've been using it a lot. recently, i was updating a man page for some software of mine which is already installed on my machine. i would do

nroff -man ./credeface.1 2>&1 | eless

but, i would always see the old man page, in spite of the fact that the new man page was right there. finally, i realized if i used less rather than eless, i would see the new man page.

that got me to look at the eless source, and it seems you parse the input enough to realize it is a man page, then decide which man page, then do (the emacs-equivalent of) man 1 credeface, so giving me the installed man page, rather than the new one i am working on.

i notice that M-x man is willing to take a filename (especially if preceded by a -l).

[insert a sentence here on 'i think this is a bug', or 'here is a feature request', or, more likely, 'i don't know what the right thing to do would be'.]

again, thanks for eless!

[edited 02.02.2023, change opinion of M-x man.]

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.