all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Saving window config using desktop globals
Date: Tue, 15 Dec 2015 05:13:59 +0100	[thread overview]
Message-ID: <87h9jkmjqw.fsf@debian.uxu> (raw)
In-Reply-To: 20151214012816.GG3346@mail.akwebsoft.com

Tim Johnson <tim@akwebsoft.com> writes:

> I've written my own system

*nod* :)

> that works with multiple .desktop files which handle
> multiple projects, for me it is not an issue of
> uptime, it's about switching projects...

uptime(1) is a UNIX/GNU tool that tells how long the
system has been up. That is all it does! It is 110
lines of C in the Debian 'procps' package.

The purpose of uptime is unclear save for being able
to boast how long the system has been up - a long
time span would imply a stable system.

There is also a hacker documentary from 2001, "Freedom
Downtime", about Kevin Mitnick. The title refers to
Mitnick being imprisoned - it is a pun on uptime.

If you get a Raspberry Pi and never shut it off, then
you get a lot of uptime if nothing else :)

By the way, I see now on IMDB that "Freedom Downtime"
is directed by "Emmanuel Goldstein" (the Trotsky of
1984). It seems some people have had a lot of fun...

There is also a motion picture on Mitnick which is
much better, "Takedown" ("Operation Takedown" in some
countries) from 2000, but it might not be factual in
every detail...

> Furthermore, a flask project (as one example, could
> have two dozen or more source files).

Are you kidding! (?)

Let's envision the smallest project thinkable, a Unix
shell tool.

- the actual program: one file in C and a header file
- a Makefile
- shell scripts and function files to do automatic testing etc.
- a README file
- a man page, i.e. groff file
- a home page: a HTML and a CSS file
- additional documentation: LaTeX, Biblatex, info, NEWS, gnuplots ...
- archives and metadata files for package managers


So big projects do have a lot of files, and yes, being
able to navigate between them quickly is imperative,
not just to the outcome but also to the enjoyment of
doing it. I always was disheartened when I had to type
long paths in the middle of creative work, which is
why I did tools so to never have to do it.

There are other ways to do what I do, but this is what
I do, and it works for me. But in principle I do
firmly think it is a much better approach than setting
up a window configuration of buffers covering the
entire scope (impossible anyway) and then never
"breaking" it...

Anyway, find files in Emacs:

    http://user.it.uu.se/~embe8573/conf/emacs-init/navigate-fs-keys.el

Ditto the shell:

    http://user.it.uu.se/~embe8573/conf/.zsh/navigate-fs

Find command (currently Emacs and zsh implemented):

    http://user.it.uu.se/~embe8573/conf/emacs-init/ide/find-command.el

This is also useful when config files look like this:

    when-internet-set-time > /dev/null # ~/.zsh/web

(defun find-file-at-line (&optional other-window)
  (interactive "P")
  (let ((possible-filename (thing-at-point 'filename))
        (find-f (if other-window #'find-file-other-window #'find-file)) )
    (if (and possible-filename (file-exists-p possible-filename))
          (apply find-f `(,possible-filename))
      (progn
        (forward-char 1)
        (find-file-at-line) ))))

When we get down to specific situation, this is an
example what you can do:

(defun c-or-cpp-switch-to-body-or-header-file ()
  (interactive)
  (let*((suffixes      (if (eq major-mode 'c-mode) '("c"  "h") '("cc" "hh")))
        (file-suffix   (nth 0 suffixes))
        (header-suffix (nth 1 suffixes))
        (name          (buffer-name)) )
    (let ((is-body                (string= (file-name-extension name) file-suffix))
          (file-name-no-extension (file-name-sans-extension name)) )
      (find-file
       (format "%s/%s" default-directory
               (if is-body
                   (format "include/%s.%s" file-name-no-extension header-suffix)
                 (format "../%s.%s"      file-name-no-extension file-suffix) ))))))

The sky is the limit :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




  parent reply	other threads:[~2015-12-15  4:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-13 19:30 Saving window config using desktop globals Tim Johnson
2015-12-13 20:35 ` Tim Johnson
2015-12-13 22:47 ` Emanuel Berg
2015-12-13 23:20   ` Emanuel Berg
2015-12-13 23:28     ` Emanuel Berg
2015-12-13 23:33       ` Tim Johnson
2015-12-13 23:41         ` Emanuel Berg
2015-12-13 23:48           ` Tim Johnson
2015-12-14  0:20             ` Emanuel Berg
2015-12-14  0:47               ` Tim Johnson
2015-12-14  0:57                 ` Emanuel Berg
2015-12-14  1:28                   ` Tim Johnson
2015-12-15  0:09                     ` [closed]Re: " Tim Johnson
2015-12-15  4:40                       ` Stefan Monnier
2015-12-16  2:27                       ` Emanuel Berg
2015-12-15  4:13                     ` Emanuel Berg [this message]
2015-12-13 23:27   ` Tim Johnson
2015-12-13 23:34     ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9jkmjqw.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.