• File Browser to show only one extension?

    From RonB@21:1/5 to All on Mon Feb 3 14:02:29 2020
    Hi,

    At this point I want to use Emacs for only one file type with the extension ".fountain." The following is in my command line when clicking an icon on
    the desktop (using Linux Mint Mate 19.3)...

    /usr/bin/emacs25 %F /home/myname/Documents/scripts

    What this does is opens Emacs and (in one window) lists all the files in the scripts sub-directory. Is there way to tell Emacs to just show the files that end with ".fountain"?

    Thanks for any pointers.

    --
    "People are innocent until alleged to be involved in some
    kind of criminal activity." — John Brennan, ex-CIA Director

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Javier@21:1/5 to RonB on Mon Feb 3 18:48:47 2020
    RonB <ronb02NOSPAM@gmail.com> wrote:
    At this point I want to use Emacs for only one file type with the extension ".fountain." The following is in my command line when clicking an icon on
    the desktop (using Linux Mint Mate 19.3)...

    /usr/bin/emacs25 %F /home/myname/Documents/scripts

    What this does is opens Emacs and (in one window) lists all the files in the scripts sub-directory. Is there way to tell Emacs to just show the files that end with ".fountain"?

    Have a look at

    M-: (info "(dired-x) Omitting Variables")

    This would omit all filenames that do not end in 'n'

    (dired-omit-files "[^n]$")
    (add-hook 'dired-mode-hook
    (lambda ()
    (dired-omit-mode 1)
    ))

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Heerdegen@21:1/5 to Javier on Tue Feb 4 13:35:13 2020
    Javier <javier@invalid.invalid> writes:

    Is there way to tell Emacs to just show the
    files that
    end with ".fountain"?

    Have a look at

    M-: (info "(dired-x) Omitting Variables")

    Yes, that also came to my mind first.

    This would omit all filenames that do not end in 'n'

    (dired-omit-files "[^n]$")
    ^^^

    Isn't there a `setq' missing (`dired-omit-files' is a variable)?

    (add-hook 'dired-mode-hook
    (lambda ()
    (dired-omit-mode 1)
    ))

    Of course this will effect the whole emacs session. The answer somewhat depends on how the OP wants to use the dired buffer and the session.

    An alternative would be to mark by extension (* .), toggle marks (t) and
    kill the marked files from the view (k). That could be done from Lisp,
    too, of course. You need to require "dired-x" to do that. It's part of
    Emacs but not loaded by default.

    It's also possible to invoke `dired' from Lisp with an explicit
    precalculated list of files instead of a directory. This approach would
    make it unnecessary to mess with dired options.


    Michael.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From RonB@21:1/5 to Michael Heerdegen on Tue Feb 4 15:33:48 2020
    On 2020-02-04, Michael Heerdegen <michael_heerdegen@web.de> wrote:
    Javier <javier@invalid.invalid> writes:

    Is there way to tell Emacs to just show the
    files that
    end with ".fountain"?

    Have a look at

    M-: (info "(dired-x) Omitting Variables")

    Yes, that also came to my mind first.

    This would omit all filenames that do not end in 'n'

    (dired-omit-files "[^n]$")
    ^^^

    Isn't there a `setq' missing (`dired-omit-files' is a variable)?

    (add-hook 'dired-mode-hook
    (lambda ()
    (dired-omit-mode 1)
    ))

    Of course this will effect the whole emacs session. The answer somewhat depends on how the OP wants to use the dired buffer and the session.

    An alternative would be to mark by extension (* .), toggle marks (t) and
    kill the marked files from the view (k). That could be done from Lisp,
    too, of course. You need to require "dired-x" to do that. It's part of Emacs but not loaded by default.

    It's also possible to invoke `dired' from Lisp with an explicit
    precalculated list of files instead of a directory. This approach would
    make it unnecessary to mess with dired options.


    Michael.

    Thanks. I've copied this all down (appended to the past post in Simplenote)
    and will study it when I get time. I'll admit that (right now) it looks kind
    of like gobble-dee-gook to me, but that's only because I'm ignorant of all things Emacs and Lisp. I can see that Emacs is an extremely powerful application.

    Again, thank you.

    --
    "People are innocent until alleged to be involved in some
    kind of criminal activity." — John Brennan, ex-CIA Director

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From RonB@21:1/5 to Javier on Tue Feb 4 15:25:11 2020
    On 2020-02-04, Javier <javier@invalid.invalid> wrote:
    RonB <ronb02NOSPAM@gmail.com> wrote:
    At this point I want to use Emacs for only one file type with the extension >> ".fountain." The following is in my command line when clicking an icon on
    the desktop (using Linux Mint Mate 19.3)...

    /usr/bin/emacs25 %F /home/myname/Documents/scripts

    What this does is opens Emacs and (in one window) lists all the files in the >> scripts sub-directory. Is there way to tell Emacs to just show the files that
    end with ".fountain"?

    Have a look at

    M-: (info "(dired-x) Omitting Variables")

    This would omit all filenames that do not end in 'n'

    (dired-omit-files "[^n]$")
    (add-hook 'dired-mode-hook
    (lambda ()
    (dired-omit-mode 1)
    ))


    Thanks! I've copied your post into Simplenote and will study it to try to figure out what you're doing. (I think, when I get time, I'll probably work through some Emacs tutorials.) Right now, however, I'm just using Emacs for
    the one purpose.

    Meanwhile, since I know a little more about shell scripts than Emacs (which
    is only slightly less than nothing), I found a solution that seems to work
    okay without having to mess with Emacs.

    A shell script I named "emf" ("em" for Emacs and "f" for fountain).

    #!/bin/bash
    cd ~/Documents/scripts
    ls -tl *.fountain
    read -p 'file: ' uservar
    emacs $uservar".fountain" &
    exit

    Since there should only be (maybe) ten to fifteen Fountain files at the most
    in my working directory at any one time, this should be sufficient. I also
    like the new files showing up at the top. Fountain-Mode is really nice in
    that all you have to do is open a ".fountain" file (or create one) to automatically be put in Fountain-Mode.

    I run the above script with "source" (source emf) so it will exit out of the terminal when Emacs starts.

    Thanks again.
    --
    "People are innocent until alleged to be involved in some
    kind of criminal activity." — John Brennan, ex-CIA Director

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Heerdegen@21:1/5 to RonB on Tue Feb 4 17:13:12 2020
    RonB <ronb02NOSPAM@gmail.com> writes:

    Thanks. I've copied this all down (appended to the past post in
    Simplenote) and will study it when I get time. I'll admit that (right
    now) it looks kind of like gobble-dee-gook to me, but that's only
    because I'm ignorant of all things Emacs and Lisp. I can see that
    Emacs is an extremely powerful application.

    Here is something to start with:

    (dired (cons (generate-new-buffer-name "your-name-here")
    (directory-files "/your/dir/" nil "\\.fontain$")))

    That creates a separate dired buffer with all fontain files in
    "/your/dir/". AFAIK, toggling sorting (s) doesn't work in such buffers, though, instead, you can sort the specified file list in a way you want.

    Michael.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From RonB@21:1/5 to RonB on Wed Feb 5 20:47:18 2020
    On 2020-02-04, RonB <ronb02NOSPAM@gmail.com> wrote:
    On 2020-02-04, Javier <javier@invalid.invalid> wrote:
    RonB <ronb02NOSPAM@gmail.com> wrote:
    At this point I want to use Emacs for only one file type with the extension >>> ".fountain." The following is in my command line when clicking an icon on >>> the desktop (using Linux Mint Mate 19.3)...

    /usr/bin/emacs25 %F /home/myname/Documents/scripts

    What this does is opens Emacs and (in one window) lists all the files in the
    scripts sub-directory. Is there way to tell Emacs to just show the files that
    end with ".fountain"?

    Have a look at

    M-: (info "(dired-x) Omitting Variables")

    This would omit all filenames that do not end in 'n'

    (dired-omit-files "[^n]$")
    (add-hook 'dired-mode-hook
    (lambda ()
    (dired-omit-mode 1)
    ))


    Thanks! I've copied your post into Simplenote and will study it to try to figure out what you're doing. (I think, when I get time, I'll probably work through some Emacs tutorials.) Right now, however, I'm just using Emacs for the one purpose.

    Meanwhile, since I know a little more about shell scripts than Emacs (which is only slightly less than nothing), I found a solution that seems to work okay without having to mess with Emacs.

    A shell script I named "emf" ("em" for Emacs and "f" for fountain).

    #!/bin/bash
    cd ~/Documents/scripts
    ls -tl *.fountain
    read -p 'file: ' uservar
    emacs $uservar".fountain" &
    exit

    Since there should only be (maybe) ten to fifteen Fountain files at the most in my working directory at any one time, this should be sufficient. I also like the new files showing up at the top. Fountain-Mode is really nice in that all you have to do is open a ".fountain" file (or create one) to automatically be put in Fountain-Mode.

    I run the above script with "source" (source emf) so it will exit out of the terminal when Emacs starts.

    Thanks again.

    I've refined the process a little by automatically opening Atril with Emacs (after choosing a file). This works well for what I need. (Made a short
    video in Vokoscreen to show what I'm talking about.) The new script looks
    like this...

    #!/bin/bash
    cd ~/Documents/scripts
    clear
    lst lfount # or ls -tl *.fountain
    read -p 'file: ' uservar
    wrxr $uservar >2 errors.txt
    em $uservar 2> errors.txt & # or emacs $uservar".fountain"
    exit

    (Calling a couple other scripts here, but doing the same as above (put what
    the scripts do in the remarks). The X Windows applications throw errors when started from a terminal, so I just redirect them to a file (though it
    probably doesn't matter since I'm closing the terminal anyhow)).

    https://drive.google.com/open?id=1JoXrJpkQVj0LezVGnS4JiFPSrGcgzy5M

    --
    The fabulous Latitude D430, running
    Linux Mint Mate 19.3 on 2GBs of RAM

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)