summaryrefslogtreecommitdiffstats
path: root/gedit-changelog-line-snippet.rst
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2015-09-24 22:47:45 +0200
committerMatěj Cepl <mcepl@cepl.eu>2015-09-24 22:49:48 +0200
commit8fcd5369775dcb4b825f6728c9df93369539a853 (patch)
treee21025360e9c32c5be96bc5640b0c5a29ca92280 /gedit-changelog-line-snippet.rst
parent87b5b78bdab9f174795224f08eadfc8d79eae9ef (diff)
downloadblog-source-8fcd5369775dcb4b825f6728c9df93369539a853.tar.gz
Initial rewrite of posts for pelican
Diffstat (limited to 'gedit-changelog-line-snippet.rst')
-rw-r--r--gedit-changelog-line-snippet.rst37
1 files changed, 37 insertions, 0 deletions
diff --git a/gedit-changelog-line-snippet.rst b/gedit-changelog-line-snippet.rst
new file mode 100644
index 0000000..098ab33
--- /dev/null
+++ b/gedit-changelog-line-snippet.rst
@@ -0,0 +1,37 @@
+gedit snippet generating RPM spec %changelog line
+#################################################
+
+:date: 2015-08-01T00:26:00
+:category: computer
+
+I have done a little bit of work to make gedit fully working in
+RHEL-7 (appropriate packages with almost all my fixes will be
+most likely available in the next minor release of RHEL-7).
+Generally my feeling is that gedit is a way less powerful (and
+writing Python plugins more complicated) than the similar stuff
+in vim. However, there are some things which are shockingly
+powerful. One of the things which quite surprised me are
+snippets_. They are **a way more** powerful than just simple text
+replacements. With this functionality I can create even something
+so crazy as this snippet generating ``%changelog`` line in the
+RPM spec files.::
+
+ $<
+ import rpm
+ import datetime
+
+ spec = rpm.spec($GEDIT_CURRENT_DOCUMENT_PATH)
+ date = datetime.date.today().strftime("%a %b %d %Y")
+ headers = spec.packages[0].header
+ version = headers['Version']
+ release = ".".join(headers['Release'].split(".")[:-1])
+ packager = headers['Packager']
+ newheader = "* %s %s - %s-%s\n- " % (date, packager, version, release)
+ return newheader
+ >
+
+To install this snippet, open ``Manage Snippets..`` in the gedit
+application menu and in the ``RPM Spec`` section create a new snippet and copy the code above to the text box on the right side. Give to this snippet some TAB trigger (I have ``chi`` there) or a key shortcut and be done. Then activate this snippet in the top of the ``%changelog`` section.
+
+.. _snippets:
+ https://wiki.gnome.org/Apps/Gedit/Plugins/Snippets