Emacs 25.2 dired mode shows .. above . How do I change this? - windows

On my win-10 machine, dired shows this:
drwxr-xr-x 58 jkb jkb 4096 Nov 5 11:08 ..
drwxr-xr-x 6 jkb jkb 4096 Nov 6 09:34 .
Where the .. entry comes first. How do I modify the installation to change it back to this:
drwxr-xr-x 6 jkb jkb 4096 Nov 6 09:34 .
drwxr-xr-x 58 jkb jkb 4096 Nov 5 11:08 ..
It is not a big issue, except that on my mint 18 machine it shows the traditional order. Uniformity would be good.
Many thanks for pointers and advice.
[See the first comment to this question for the answer]

Formal answer:
I can solve my issue by setting ls-lisp-UCA-like-collation to nil:
'(ls-list-UCA-like-collation nil)
in the customize section of my .emacs file or via the customize menus.
The change has the side-effect of changing the ordering of the cygwin home directory, the ~/.* files come first now.
There may be another option to fix that, if it is important.
Note that this is an issue with dired on emacs, using ls-lisp.

Related

Cannot give myself root my permissions

I am trying to give myself root access to all the file in this folder and not have to sudo everything I want to run a command.
The file I am concerned with is pro
When I enter ls -l I get :
drwxr-xr-x+ 12 Guest _guest 384 13 Jan 14:56 Guest
drwxrwxrwt 9 root wheel 288 13 Jan 14:30 Shared
drwxr-xr-x+ 148 Santi staff 4736 1 Apr 17:13 pro
then I enter chmod 775 pro/
It doesnt seem to change the permssions. What can I do to fix this or why is the folder restricting permission even though I appear to be root?
drwxr-xr-x+ ...
the final + means that the file is governed by acl
see
apropos acl : give you the mans to consult
wikipedia
Access Control Lists on Arch wiki

Bash - What is the best way to save the value of a quantity after the script has terminated?

I am attempting to write a script that changes my desktop wallpaper to the next picture in my ~\Picture\Wallpapers directory. I have already created a script, change_wallpaper, which can change my desktop background to any given picture.
My plan was to list all the pictures in ~\Picture\Wallpapers as an array, find the index i of the current wallpaper, and apply change_wallpaper to the i+1 element of the array of pictures. My only issue is finding a way to story the index of the current wallpaper. I could create a file which contains this value, but it seems really inelegant to just have a text file with the number 12, for example, saved somewhere in my home directory.
Is there a better way?
I agree with the general consensus of using a file to store the index of the current wallpaper. A slightly more elegant way would be to put a "." (dot) in front of the file name to keep it hidden in the directory where your script is located. Something like:
admin#myHost:/home/admin$ ls -la
total 6200
drwxrwxr-x 4 admin admin 4096 Jul 02 15:41 .
drwxr-xr-x 71 bin bin 4096 Jun 29 12:43 ..
-rw------- 1 admin admin 3939 Jun 29 16:02 .bash_history
-rw-r--r-- 1 admin admin 21 Nov 04 2014 .bashrc
-rwxr-x--x 1 admin admin 259 Oct 13 2014 .profile
-rw------- 1 admin admin 3939 Jun 29 16:02 .wallpaper_index
-rw------- 1 admin admin 3939 Jun 29 16:02 change_wallpaper
There are countless linux and unix applications that do this.

Unix - pipeline ls - la | less C executable giving double total file size vs shell

*Edit - Stephen has answered this question in the comments below *
so basically I have made two seperate child processes(using two seperate methods with their own fork) to execute the command ls -la | less using pipe.
The first one executes ls like this:
execl("/bin/ls", "ls", "-la", NULL);
The second child process executes less like this:
execlp("less", "less", NULL);
And the results come up fine.. apart from one little part:
Results using shell command:
total 15
drwxr-xr-x 2 daniel staff 4 2015-02-27 18:58 .
drwxr-xr-x 15 daniel staff 24 2015-02-27 18:58 ..
-rwxr-xr-x 1 daniel staff 9280 2015-02-27 18:58 pipes
-rw-r--r-- 1 daniel staff 1419 2015-02-27 18:58 pipes.c
Results using my executable:
total 30
drwxr-xr-x 2 daniel staff 4 Feb 27 18:58 .
drwxr-xr-x 15 daniel staff 24 Feb 27 18:58 ..
-rwxr-xr-x 1 daniel staff 9280 Feb 27 18:58 pipes
-rw-r--r-- 1 daniel staff 1419 Feb 27 18:58 pipes.c
Now the date being a different format I don't care about.. but the total size is twice as large with my executable(30 vs 15). Why is this happening?
Make sure that the ls you are running from the shell and the ls that is running in your program are the same program.
Your program is specifying /bin/ls as the program to run; you can find out what is being run when you type the command at the shell prompt by using the shell command which ls (also see type ls).
If these are different it could be due to the POSIX vs. GNU blocksize used in the total size computation.
This answer indicates that POSIX and GNU tools differ in the blocksize they use to compute the total. Try adding h to your command and compare the results (this flag makes the units explicit). My guess is that the execution environment of these processes is disturbing the result. For instance it may not be the same ls that you are running.

How to create drag and drop DMG file, Mac installer

Hi I have created an aplication myprogram.app file. Now I want to create Drag and drop DMG file for that application. Skype and other software does the same thing.
How to create Drag and Drop DMG file foe my application.
Thanks
Sunil Kumar Sahoo
It's actually pretty easy. You just need to compose some hidden files. Easy way to do this is to just copy someone elses and change to suit your app.
For example, if I mount the MonoDevelop DMG, then I see:
atom:MonoDevelop fak$ ls -al
total 40
drwxr-xr-x 8 fak staff 340 Nov 4 14:03 .
drwxrwxrwt# 10 root admin 340 Nov 10 21:33 ..
-rw-r--r--# 1 fak staff 12292 Nov 4 14:03 .DS_Store
d-wx-wx-wt 2 fak staff 68 Nov 4 14:03 .Trashes
drwxr-xr-x 3 fak staff 102 Nov 4 14:03 .background
drwx------ 4 fak staff 136 Nov 4 14:03 .fseventsd
lrwxr-xr-x 1 fak staff 13 Nov 4 14:03 Applications -> /Applications
drwxr-xr-x 3 fak staff 102 Nov 4 14:02 MonoDevelop.app
Here we see .background that is a directory with a PNG file (the background). The app itself (MonoDevelop.app) and a link to /Applications.
The .DS_Store contains the window size, icon positions, etc. Just setup a directory and use the .DS_Store from it.
There's really not any magic to this. You can create a disk image with Disk Utility. Put the stuff on it that you need, and then convert it to a compressed read-only image (again, with Disk Utility).
For some tips on prettying up the appearance of the window, check out this question. If you need to automate this process, check out this other question for some ways to do that.

Use rsync to copy only hidden files

I want to back up all the hidden files and directories in my homedir using rsync, but not the non-hidden files and directories.
For example, given this directory listing:
drwxr-xr-x 7 sophie sophie 238 31 Mar 08:45 .
drwxr-xr-x 15 sophie sophie 510 31 Mar 08:14 ..
-rw-r--r-- 1 sophie sophie 4 31 Mar 08:12 .foo
drwxr-xr-x 3 sophie sophie 102 31 Mar 08:45 .hiddendir
drwxr-xr-x 4 sophie sophie 136 31 Mar 08:13 VisibleDirectory
-rw-r--r-- 1 sophie sophie 9 31 Mar 08:13 VisibleFile
I want to back up .foo, .hiddendir, and all the contents of .hiddendir whether they are hidden or not. I don't want to back up VisibleDirectory or VisibleFile.
All the incantations I have come up with back up ".", and therefore all its contents including VisibleFile and VisibleDirectory, and I can't figure out how to exclude it. Please help!
I'm using Mac OS X 10.5.6 (Leopard) and rsync version 2.6.9 protocol version 29.
A common pattern to match the hidden items is .[^.]*
rsync -a ~/.[^.]* /path/to/backup
This copies all files starting with a single dot. Note that it doesn't include files starting with more than one dot.
It's usually ".??*" to make sure you don't copy "." and ".."
(What if you had a file that was just ".a" ?)
Have you tried incarnations like ./.*?
Could you copy the hidden files to a temp directory, back up the temp directory, then remove it?

Resources