{"id":517,"date":"2005-11-30T19:27:12","date_gmt":"2005-11-30T09:27:12","guid":{"rendered":"http:\/\/www.flamingspork.com\/blog\/?p=517"},"modified":"2005-11-30T19:27:19","modified_gmt":"2005-11-30T09:27:19","slug":"new-emacs-snippet","status":"publish","type":"post","link":"https:\/\/www.flamingspork.com\/blog\/2005\/11\/30\/new-emacs-snippet\/","title":{"rendered":"new .emacs snippet"},"content":{"rendered":"<p>for the non lisp hackers &#8211; this sets some c mode options depending on the name of the path to the source file.<\/p>\n<p><code><br \/>\n;; run this for mysql source<br \/>\n(defun mysql-c-mode-common-hook () (setq indent-tabs-mode nil))<\/p>\n<p>;; linux kernel style<br \/>\n(defun linux-c-mode-common-hook () linux-c-mode)<\/p>\n<p>(setq my-c-mode-common-hook '(lambda ()<br \/>\n\t\t\t\t  (turn-on-font-lock)<br \/>\n\t\t\t\t  (setq comment-column 48)<br \/>\n\t\t\t\t  )<br \/>\n      )<\/p>\n<p>;; predicates to check<br \/>\n(defvar my-style-selective-mode-hook nil)<\/p>\n<p>(add-hook 'my-style-selective-mode-hook<br \/>\n      '((string-match \"MySQL\" (buffer-file-name)) . mysql-c-mode-common-hook)<br \/>\n)<\/p>\n<p>(add-hook 'my-style-selective-mode-hook<br \/>\n      '((string-match \"linux\" (buffer-file-name)) . linux-c-mode-common-hook)<br \/>\n)<\/p>\n<p>;; default hook<br \/>\n(add-hook 'my-style-selective-mode-hook<br \/>\n\t  '(t . my-c-mode-common-hook) t)<\/p>\n<p>;; find which hook to run depending on predicate<br \/>\n(defun my-style-selective-mode-hook-function ()<br \/>\n  \"Run each PREDICATE in `my-style-selective-mode-hook' to see if the<br \/>\nHOOK in the pair should be executed. If the PREDICATE evaluate to non<br \/>\nnil HOOK is executed and the rest of the hooks are ignored.\"<br \/>\n  (let ((h my-style-selective-mode-hook))<br \/>\n    (while (not (eval (caar h)))<br \/>\n      (setq h (cdr h)))<br \/>\n    (funcall (cdar h))))<\/p>\n<p>;; Add the selective hook to the c-mode-common-hook<br \/>\n(add-hook 'c-mode-common-hook 'my-style-selective-mode-hook-function)<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>for the non lisp hackers &#8211; this sets some c mode options depending on the name of the path to the source file. ;; run this for mysql source (defun mysql-c-mode-common-hook () (setq indent-tabs-mode nil)) ;; linux kernel style (defun &hellip; <a href=\"https:\/\/www.flamingspork.com\/blog\/2005\/11\/30\/new-emacs-snippet\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[14],"tags":[],"class_list":["post-517","post","type-post","status-publish","format-standard","hentry","category-mysql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5a6n8-8l","jetpack-related-posts":[{"id":1627,"url":"https:\/\/www.flamingspork.com\/blog\/2009\/05\/09\/does-linux-fallocate-zero-fill\/","url_meta":{"origin":517,"position":0},"title":"Does linux fallocate() zero-fill?","author":"Stewart Smith","date":"2009-05-09","format":false,"excerpt":"In an email disscussion for pre-allocating binlogs for MySQL (something we'll likely have to do for Drizzle and replication), Yoshinori brought up the excellent point of that in some situations you don't want to be doing zero-fill as getting up and running quickly is the most important thing. So what\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3884,"url":"https:\/\/www.flamingspork.com\/blog\/2014\/10\/14\/mysql-5-7-5-on-power-thread-priority\/","url_meta":{"origin":517,"position":1},"title":"MySQL 5.7.5 on POWER &#8211; thread priority","author":"Stewart Smith","date":"2014-10-14","format":false,"excerpt":"Good news everyone! MySQL 5.7.5 is out with a bunch more patches for running well on POWER in the tree. I haven't yet gone and tried it all out, but since I'm me, I look at bugs database and git\/bzr history first. On Intel CPUs, when you're spinning on a\u2026","rel":"","context":"In &quot;IBM&quot;","block_context":{"text":"IBM","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/ibm-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3699,"url":"https:\/\/www.flamingspork.com\/blog\/2014\/03\/13\/ghosts-of-mysql-past-part-9-best-team-name-ever\/","url_meta":{"origin":517,"position":2},"title":"Ghosts of MySQL Past, Part 9: BEST. Team. Name. EVER.","author":"Stewart Smith","date":"2014-03-13","format":false,"excerpt":"(This is part 9 in a series, part 8 is here - because reverse chronological order totally makes sense here) So, back around 2007, somebody noticed that an awful lot of the downloads of MySQL and associated utilities from mysql.com were for Windows. Of course, it's then immediately pointed out\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1395,"url":"https:\/\/www.flamingspork.com\/blog\/2009\/02\/12\/performance-schema-show-me-the-code\/","url_meta":{"origin":517,"position":3},"title":"Performance Schema: Show me the code","author":"Stewart Smith","date":"2009-02-12","format":false,"excerpt":"For such a long worked on feature, with such potential - I find the resistence to publishing a source tree curious (my comments on the topic have been moderated away but others have asked too). I could go and grep through the commits list searching for things (hint: look for\u2026","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1576,"url":"https:\/\/www.flamingspork.com\/blog\/2009\/02\/25\/no-implicit-defaults\/","url_meta":{"origin":517,"position":4},"title":"No implicit defaults","author":"Stewart Smith","date":"2009-02-25","format":false,"excerpt":"See also: MySQL Bug 43151 The MySQL Manual proudly states that you don't get implicit default values if strict mode. mysql> set sql_mode='STRICT_ALL_TABLES'; Query OK, 0 rows affected (0.00 sec) mysql> create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i\u2026","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3312,"url":"https:\/\/www.flamingspork.com\/blog\/2013\/04\/26\/a-few-notes-on-innodb-in-mysql-5-7-1\/","url_meta":{"origin":517,"position":5},"title":"A few notes on InnoDB in MySQL 5.7.1","author":"Stewart Smith","date":"2013-04-26","format":false,"excerpt":"I've started poking around the MySQL 5.7.1 source tree (although just from tarball as I don't see a BZR tree yet). I thought I'd share a few thoughts: InnoDB temporary tables. Not REDO logged. What does this mean? It's a huge step in removing the dependency on MEMORY and MyISAM\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/comments?post=517"}],"version-history":[{"count":0,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/517\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/media?parent=517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/categories?post=517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/tags?post=517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}