@@ -64,17 +64,20 @@ Contents ~
64
64
10. The | xolox#misc#path#decode() | function
65
65
11. The | xolox#misc#path#is_relative() | function
66
66
12. The | xolox#misc#path#tempdir() | function
67
- 13. Persist/recall Vim values from/to files | misc-persist-recall-vim-values-from-to-files |
67
+ 13. Manipulation of UNIX file permissions | misc-manipulation-of-unix-file-permissions |
68
+ 1. The | xolox#misc#perm#get() | function
69
+ 2. The | xolox#misc#perm#set() | function
70
+ 14. Persist/recall Vim values from/to files | misc-persist-recall-vim-values-from-to-files |
68
71
1. The | xolox#misc#persist#load() | function
69
72
2. The | xolox#misc#persist#save() | function
70
- 14 . String handling | misc-string-handling |
73
+ 15 . String handling | misc-string-handling |
71
74
1. The | xolox#misc#str#slug() | function
72
75
2. The | xolox#misc#str#ucfirst() | function
73
76
3. The | xolox#misc#str#compact() | function
74
77
4. The | xolox#misc#str#trim() | function
75
78
5. The | xolox#misc#str#indent() | function
76
79
6. The | xolox#misc#str#dedent() | function
77
- 15 . Test runner & infrastructure for Vim plug-ins | misc-test-runner-infrastructure-for-vim-plug-ins |
80
+ 16 . Test runner & infrastructure for Vim plug-ins | misc-test-runner-infrastructure-for-vim-plug-ins |
78
81
1. The | xolox#misc#test#reset() | function
79
82
2. The | xolox#misc#test#summarize() | function
80
83
3. The | xolox#misc#test#wrap() | function
@@ -83,7 +86,7 @@ Contents ~
83
86
6. The | xolox#misc#test#assert_true() | function
84
87
7. The | xolox#misc#test#assert_equals() | function
85
88
8. The | xolox#misc#test#assert_same_type() | function
86
- 16 . Tests for the miscellaneous Vim scripts | tests-for-miscellaneous-vim-scripts |
89
+ 17 . Tests for the miscellaneous Vim scripts | tests-for-miscellaneous-vim-scripts |
87
90
1. The | xolox#misc#tests#run() | function
88
91
2. The | xolox#misc#tests#pattern_escaping() | function
89
92
3. The | xolox#misc#tests#substitute_escaping() | function
@@ -107,12 +110,12 @@ function
107
110
19. The | xolox#misc#tests#multiline_string_dedent() | function
108
111
20. The | xolox#misc#tests#version_string_parsing() | function
109
112
21. The | xolox#misc#tests#version_string_comparison() | function
110
- 17 . Timing of long during operations | misc-timing-of-long-during-operations |
113
+ 18 . Timing of long during operations | misc-timing-of-long-during-operations |
111
114
1. The | xolox#misc#timer#start() | function
112
115
2. The | xolox#misc#timer#stop() | function
113
116
3. The | xolox#misc#timer#force() | function
114
117
4. The | xolox#misc#timer#convert() | function
115
- 18 . Version string handling | misc-version-string-handling |
118
+ 19 . Version string handling | misc-version-string-handling |
116
119
1. The | xolox#misc#version#parse() | function
117
120
2. The | xolox#misc#version#at_least() | function
118
121
4. Contact | misc-contact |
@@ -162,8 +165,8 @@ For those who are curious: The function descriptions given below were extracted
162
165
from the source code of the miscellaneous scripts using the Python module
163
166
'vimdoctool.py' included in vim-tools [5].
164
167
165
- The documentation of the 89 functions below was extracted from 18 Vim scripts
166
- on June 22 , 2014 at 02:54 .
168
+ The documentation of the 91 functions below was extracted from 19 Vim scripts
169
+ on June 29 , 2014 at 23:33 .
167
170
168
171
-------------------------------------------------------------------------------
169
172
*misc-asynchronous-vim-script-evaluation*
@@ -771,6 +774,40 @@ The *xolox#misc#path#tempdir()* function
771
774
772
775
Create a temporary directory and return the pathname of the directory.
773
776
777
+ -------------------------------------------------------------------------------
778
+ *misc-manipulation-of-unix-file-permissions*
779
+ Manipulation of UNIX file permissions ~
780
+
781
+ Vim's | writefile() | function cannot set file permissions for newly created
782
+ files and although Vim script has a function to get file permissions (see
783
+ | getfperm() | ) there is no equivalent for changing a file's permissions.
784
+
785
+ This omission breaks the otherwise very useful idiom of updating a file by
786
+ writing its new contents to a temporary file and then renaming the temporary
787
+ file into place (which is as close as you're going to get to atomically
788
+ updating a file's contents on UNIX) because the file's permissions will not be
789
+ preserved!
790
+
791
+ **Here's a practical example:** My vim-easytags [6] plug-in writes tags file
792
+ updates to a temporary file and renames the temporary file into place. When I
793
+ use 'sudo -s' on Ubuntu Linux it preserves my environment variables so my
794
+ '~/.vimrc' and the vim-easytags [6] plug-in are still loaded. Now when a tags
795
+ file is written the file becomes owned by root (my effective user id in the
796
+ 'sudo' session). Once I leave the 'sudo' session I can no longer update my tags
797
+ file because it's now owned by root … ಠ_ಠ
798
+
799
+ -------------------------------------------------------------------------------
800
+ The *xolox#misc#perm#get()* function
801
+
802
+ Get the permissions of the pathname given as the first argument. Returns a
803
+ string which you can later pass to | xolox#misc#perm#set() | .
804
+
805
+ -------------------------------------------------------------------------------
806
+ The *xolox#misc#perm#set()* function
807
+
808
+ Set the permissions (the second argument) of the pathname given as the first
809
+ argument. Expects a permissions string created by | xolox#misc#perm#get() | .
810
+
774
811
-------------------------------------------------------------------------------
775
812
*misc-persist-recall-vim-values-from-to-files*
776
813
Persist/recall Vim values from/to files ~
@@ -1084,7 +1121,7 @@ Online [15].
1084
1121
*misc-license*
1085
1122
License ~
1086
1123
1087
- This software is licensed under the MIT license [16] . Š 2014 Peter Odding
1124
+ This software is licensed under the MIT license [16] . © 2014 Peter Odding
1088
1125
1089
1126
1090
1127
===============================================================================
0 commit comments