You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/intro.rst
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,8 @@ You can unregister the callback later, either by using the name of the function,
79
79
A simple example
80
80
----------------
81
81
82
-
Let's register a callback for the FILESAVING event - the occurs just before the file is saved, and we'll add a "saved on" log entry to the end of the file, if the filename ends in '.log'.::
82
+
Let's register a callback for the FILESAVING event - the occurs just before the file is saved,
83
+
and we'll add a "saved on" log entry to the end of the file, if the filename ends in '.log'.::
83
84
84
85
import datetime
85
86
@@ -103,7 +104,8 @@ Really, we should improve this function a little. Currently, it assumes the file
103
104
104
105
The ``args`` parameter to the function is a map (similar a dictionary in C# or a hashmap in Java), that contains the arguments for the event - many events are signalled for a ``BufferID``, which is the Notepad++ internal number for a particular file or tab. We can do things with the bufferID like get the filename, switch to it to make it active and so on.
105
106
106
-
So, first we'll change it so that we check the filename of the bufferID being saved, rather than the active document. Then, if the filename has a '.log' extension, we'll change to it and add our "File saved on ....." line.
107
+
So, first we'll change it so that we check the filename of the bufferID being saved, rather than the active document.
108
+
Then, if the filename has a '.log' extension, we'll change to it and add our "File saved on ....." line.::
107
109
108
110
import datetime
109
111
@@ -116,7 +118,8 @@ So, first we'll change it so that we check the filename of the bufferID being sa
116
118
117
119
118
120
119
-
Great, now it works properly. There's a side effect though, if we do use save-all, we might change the active document, which might seem a bit strange when we use it. Again, very easy to fix.
121
+
Great, now it works properly. There's a side effect though, if we do use save-all, we might change the active document,
122
+
which might seem a bit strange when we use it. Again, very easy to fix.::
0 commit comments