diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,21 @@
+## Ormolu 0.3.0.1
+
+* Improvements to `.cabal` file handling:
+   * When looking for a `.cabal` file, directories were previously
+     erroneously also considered. [Issue 781](
+     https://github.com/tweag/ormolu/issues/781).
+   * We now print a note if Ormolu was told to consider
+     `.cabal` files, but no suitable one could be found.
+   * Handle an empty `hs-source-dirs` correctly.
+   * Also consider modules which are only conditionally listed
+     in the `.cabal` file.
+
+* The special handling of CPP is now only applied if CPP is
+  actually enabled. [Issue 782](https://github.com/tweag/ormolu/issues/782).
+
+* The left hand side of the `:` operator now uses braces if
+  necessary. [Issue 780](https://github.com/tweag/ormolu/issues/780).
+
 ## Ormolu 0.3.0.0
 
 * Data declarations with multiline kind signatures are now formatted
@@ -29,9 +47,12 @@
      673](https://github.com/tweag/ormolu/issues/673).
    * Strings like `-}` can now be present in disabled regions.
      [Issue 708](https://github.com/tweag/ormolu/issues/708).
-   * As a side effect, using the magic comments like in
-     [Issue 601](https://github.com/tweag/ormolu/issues/601)
-     is no longer supported.
+
+  This means that using CPP or magic comments in certain ways which
+  were only supported as a side effect previously (like in
+  [Issue 601](https://github.com/tweag/ormolu/issues/601))
+  will now result in formatting failures. Also see [Issue 774](
+  https://github.com/tweag/ormolu/issues/774).
 
 ## Ormolu 0.2.0.0
 
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -51,17 +51,9 @@
 cache][iohk-hydra-binary-cache], otherwise building may take a very long
 time.
 
-Alternatively, `stack` could be used with a `stack.yaml` file as follows:
+Alternatively, `stack` could be used as follows:
 
 ```console
-$ cat stack.yaml
-resolver: lts-18.6
-packages:
-- '.'
-extra-deps:
-- Cabal-3.4.0.0
-- ghc-lib-parser-9.0.1.20210324
-
 $ stack build # to build
 $ stack install # to install
 ```
diff --git a/data/examples/declaration/splice/quasiquote-out.hs b/data/examples/declaration/splice/quasiquote-out.hs
--- a/data/examples/declaration/splice/quasiquote-out.hs
+++ b/data/examples/declaration/splice/quasiquote-out.hs
@@ -10,3 +10,7 @@
 [d|    foo bar
 
 |]
+
+header =
+  [here|
+#include foo|]
diff --git a/data/examples/declaration/splice/quasiquote.hs b/data/examples/declaration/splice/quasiquote.hs
--- a/data/examples/declaration/splice/quasiquote.hs
+++ b/data/examples/declaration/splice/quasiquote.hs
@@ -9,3 +9,6 @@
 [d|    foo bar
 
 |]
+
+header = [here|
+#include foo|]
diff --git a/data/examples/declaration/value/function/operators-7-out.hs b/data/examples/declaration/value/function/operators-7-out.hs
new file mode 100644
--- /dev/null
+++ b/data/examples/declaration/value/function/operators-7-out.hs
@@ -0,0 +1,1 @@
+foo c = case c of { _ -> c } : []
diff --git a/data/examples/declaration/value/function/operators-7.hs b/data/examples/declaration/value/function/operators-7.hs
new file mode 100644
--- /dev/null
+++ b/data/examples/declaration/value/function/operators-7.hs
@@ -0,0 +1,1 @@
+foo c = case c of {_->c} : []
diff --git a/data/examples/other/cpp/continuation-out.hs b/data/examples/other/cpp/continuation-out.hs
--- a/data/examples/other/cpp/continuation-out.hs
+++ b/data/examples/other/cpp/continuation-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 foo :: Int
 foo = 5
 
diff --git a/data/examples/other/cpp/continuation.hs b/data/examples/other/cpp/continuation.hs
--- a/data/examples/other/cpp/continuation.hs
+++ b/data/examples/other/cpp/continuation.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 foo :: Int
 foo = 5
 
diff --git a/data/examples/other/cpp/lonely-hash-out.hs b/data/examples/other/cpp/lonely-hash-out.hs
--- a/data/examples/other/cpp/lonely-hash-out.hs
+++ b/data/examples/other/cpp/lonely-hash-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 module Main (main) where
 
 import Data.Void
diff --git a/data/examples/other/cpp/lonely-hash.hs b/data/examples/other/cpp/lonely-hash.hs
--- a/data/examples/other/cpp/lonely-hash.hs
+++ b/data/examples/other/cpp/lonely-hash.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 module Main (main) where
 
 import Data.Void
diff --git a/data/examples/other/cpp/separation-0a-out.hs b/data/examples/other/cpp/separation-0a-out.hs
--- a/data/examples/other/cpp/separation-0a-out.hs
+++ b/data/examples/other/cpp/separation-0a-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 instance Stream s => Monad (ParsecT e s m) where
   return = pure
   (>>=) = pBind
diff --git a/data/examples/other/cpp/separation-0a.hs b/data/examples/other/cpp/separation-0a.hs
--- a/data/examples/other/cpp/separation-0a.hs
+++ b/data/examples/other/cpp/separation-0a.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 instance Stream s => Monad (ParsecT e s m) where
   return = pure
   (>>=)  = pBind
diff --git a/data/examples/other/cpp/separation-0b-out.hs b/data/examples/other/cpp/separation-0b-out.hs
--- a/data/examples/other/cpp/separation-0b-out.hs
+++ b/data/examples/other/cpp/separation-0b-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 instance Stream s => Monad (ParsecT e s m) where
   return = pure
   (>>=) = pBind
diff --git a/data/examples/other/cpp/separation-0b.hs b/data/examples/other/cpp/separation-0b.hs
--- a/data/examples/other/cpp/separation-0b.hs
+++ b/data/examples/other/cpp/separation-0b.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 instance Stream s => Monad (ParsecT e s m) where
   return = pure
   (>>=)  = pBind
diff --git a/data/examples/other/cpp/separation-1a-out.hs b/data/examples/other/cpp/separation-1a-out.hs
--- a/data/examples/other/cpp/separation-1a-out.hs
+++ b/data/examples/other/cpp/separation-1a-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 decompressingPipe ::
   (PrimMonad m, MonadThrow m, MonadResource m) =>
   CompressionMethod ->
diff --git a/data/examples/other/cpp/separation-1a.hs b/data/examples/other/cpp/separation-1a.hs
--- a/data/examples/other/cpp/separation-1a.hs
+++ b/data/examples/other/cpp/separation-1a.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 decompressingPipe
   :: (PrimMonad m, MonadThrow m, MonadResource m)
   => CompressionMethod
diff --git a/data/examples/other/cpp/separation-1b-out.hs b/data/examples/other/cpp/separation-1b-out.hs
--- a/data/examples/other/cpp/separation-1b-out.hs
+++ b/data/examples/other/cpp/separation-1b-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 decompressingPipe ::
   (PrimMonad m, MonadThrow m, MonadResource m) =>
   CompressionMethod ->
diff --git a/data/examples/other/cpp/separation-1b.hs b/data/examples/other/cpp/separation-1b.hs
--- a/data/examples/other/cpp/separation-1b.hs
+++ b/data/examples/other/cpp/separation-1b.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 decompressingPipe
   :: (PrimMonad m, MonadThrow m, MonadResource m)
   => CompressionMethod
diff --git a/data/examples/other/cpp/separation-2a-out.hs b/data/examples/other/cpp/separation-2a-out.hs
--- a/data/examples/other/cpp/separation-2a-out.hs
+++ b/data/examples/other/cpp/separation-2a-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 ffff, ffffffff :: Natural
 #ifdef HASKELL_ZIP_DEV_MODE
 ffff     = 200
diff --git a/data/examples/other/cpp/separation-2a.hs b/data/examples/other/cpp/separation-2a.hs
--- a/data/examples/other/cpp/separation-2a.hs
+++ b/data/examples/other/cpp/separation-2a.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 ffff, ffffffff :: Natural
 #ifdef HASKELL_ZIP_DEV_MODE
 ffff     = 200
diff --git a/data/examples/other/cpp/separation-2b-out.hs b/data/examples/other/cpp/separation-2b-out.hs
--- a/data/examples/other/cpp/separation-2b-out.hs
+++ b/data/examples/other/cpp/separation-2b-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 ffff, ffffffff :: Natural
 #ifdef HASKELL_ZIP_DEV_MODE
 ffff     = 200
diff --git a/data/examples/other/cpp/separation-2b.hs b/data/examples/other/cpp/separation-2b.hs
--- a/data/examples/other/cpp/separation-2b.hs
+++ b/data/examples/other/cpp/separation-2b.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 ffff, ffffffff :: Natural
 #ifdef HASKELL_ZIP_DEV_MODE
 ffff     = 200
diff --git a/data/examples/other/cpp/shifted-out.hs b/data/examples/other/cpp/shifted-out.hs
--- a/data/examples/other/cpp/shifted-out.hs
+++ b/data/examples/other/cpp/shifted-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 sinkData h compression = do
   (uncompressedSize, crc32, compressedSize) <-
     case compression of
diff --git a/data/examples/other/cpp/shifted.hs b/data/examples/other/cpp/shifted.hs
--- a/data/examples/other/cpp/shifted.hs
+++ b/data/examples/other/cpp/shifted.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 sinkData h compression = do
   (uncompressedSize, crc32, compressedSize) <-
     case compression of
diff --git a/data/examples/other/cpp/simple-import-out.hs b/data/examples/other/cpp/simple-import-out.hs
--- a/data/examples/other/cpp/simple-import-out.hs
+++ b/data/examples/other/cpp/simple-import-out.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 module Main (main) where
 
 import Data.Void
diff --git a/data/examples/other/cpp/simple-import.hs b/data/examples/other/cpp/simple-import.hs
--- a/data/examples/other/cpp/simple-import.hs
+++ b/data/examples/other/cpp/simple-import.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 module Main (main) where
 
 import Data.Void
diff --git a/ormolu.cabal b/ormolu.cabal
--- a/ormolu.cabal
+++ b/ormolu.cabal
@@ -1,6 +1,6 @@
 cabal-version:      2.4
 name:               ormolu
-version:            0.3.0.0
+version:            0.3.0.1
 license:            BSD-3-Clause
 license-file:       LICENSE.md
 maintainer:         Mark Karpov <mark.karpov@tweag.io>
@@ -149,11 +149,13 @@
     build-depends:
         base >=4.12 && <5.0,
         containers >=0.5 && <0.7,
+        directory ^>=1.3,
         filepath >=1.2 && <1.5,
         hspec >=2.0 && <3.0,
         ormolu,
         path >=0.6 && <0.10,
         path-io >=1.4.2 && <2.0,
+        temporary ^>=1.3,
         text >=0.2 && <1.3
 
     if flag(dev)
diff --git a/src/Ormolu/Parser.hs b/src/Ormolu/Parser.hs
--- a/src/Ormolu/Parser.hs
+++ b/src/Ormolu/Parser.hs
@@ -17,6 +17,7 @@
 import qualified Data.List.NonEmpty as NE
 import Data.Ord (Down (Down))
 import GHC.Data.Bag (bagToList)
+import qualified GHC.Data.EnumSet as EnumSet
 import qualified GHC.Data.FastString as GHC
 import qualified GHC.Data.StringBuffer as GHC
 import qualified GHC.Driver.CmdLine as GHC
@@ -71,7 +72,8 @@
                 (mkSrcLoc (GHC.mkFastString path) 1 1)
                 (mkSrcLoc (GHC.mkFastString path) 1 1)
          in throwIO (OrmoluParsingFailed loc err)
-  snippets <- runExceptT . forM (preprocess cfgRegion rawInput) $ \case
+  let cppEnabled = EnumSet.member Cpp (GHC.extensionFlags dynFlags)
+  snippets <- runExceptT . forM (preprocess cppEnabled cfgRegion rawInput) $ \case
     Right region ->
       fmap ParsedSnippet . ExceptT $
         parseModuleSnippet (config $> region) dynFlags path rawInput
diff --git a/src/Ormolu/Printer/Meat/Declaration/Value.hs b/src/Ormolu/Printer/Meat/Declaration/Value.hs
--- a/src/Ormolu/Printer/Meat/Declaration/Value.hs
+++ b/src/Ormolu/Printer/Meat/Declaration/Value.hs
@@ -1330,7 +1330,7 @@
   useRecordDot' <- useRecordDot
   if
       | gotColon -> do
-        lhs
+        ub lhs
         space
         p_op
         case placement of
diff --git a/src/Ormolu/Processing/Preprocess.hs b/src/Ormolu/Processing/Preprocess.hs
--- a/src/Ormolu/Processing/Preprocess.hs
+++ b/src/Ormolu/Processing/Preprocess.hs
@@ -27,10 +27,15 @@
 
 -- | Preprocess the specified region of the input into raw snippets
 -- and subregions to be formatted.
-preprocess :: RegionDeltas -> String -> [Either Text RegionDeltas]
-preprocess region rawInput = rawSnippetsAndRegionsToFormat
+preprocess ::
+  -- | Whether CPP is enabled
+  Bool ->
+  RegionDeltas ->
+  String ->
+  [Either Text RegionDeltas]
+preprocess cppEnabled region rawInput = rawSnippetsAndRegionsToFormat
   where
-    (linesNotToFormat', replacementLines) = linesNotToFormat region rawInput
+    (linesNotToFormat', replacementLines) = linesNotToFormat cppEnabled region rawInput
     regionsToFormat =
       intSetToRegions rawLineLength $
         IntSet.fromAscList [1 .. rawLineLength] IntSet.\\ linesNotToFormat'
@@ -81,8 +86,13 @@
 
 -- | All lines we are not supposed to format, and a set of replacements
 -- for specific lines.
-linesNotToFormat :: RegionDeltas -> String -> (IntSet, IntMap String)
-linesNotToFormat region@RegionDeltas {..} input =
+linesNotToFormat ::
+  -- | Whether CPP is enabled
+  Bool ->
+  RegionDeltas ->
+  String ->
+  (IntSet, IntMap String)
+linesNotToFormat cppEnabled region@RegionDeltas {..} input =
   (unconsidered <> magicDisabled <> otherDisabled, lineUpdates)
   where
     unconsidered =
@@ -91,7 +101,9 @@
     totalLines = length (lines input)
     regionLines = linesInRegion region input
     (magicDisabled, lineUpdates) = magicDisabledLines regionLines
-    otherDisabled = (cppLines <> shebangLines <> linePragmaLines) regionLines
+    otherDisabled = (mconcat allLines) regionLines
+      where
+        allLines = [shebangLines, linePragmaLines] <> [cppLines | cppEnabled]
 
 -- | Ormolu state.
 data OrmoluState
diff --git a/src/Ormolu/Utils/Extensions.hs b/src/Ormolu/Utils/Extensions.hs
--- a/src/Ormolu/Utils/Extensions.hs
+++ b/src/Ormolu/Utils/Extensions.hs
@@ -14,18 +14,19 @@
 import Control.Exception
 import Control.Monad.IO.Class
 import qualified Data.ByteString as B
-import Data.List (find)
 import Data.Map.Lazy (Map)
 import qualified Data.Map.Lazy as M
 import Data.Maybe (maybeToList)
 import qualified Distribution.ModuleName as ModuleName
 import Distribution.PackageDescription
 import Distribution.PackageDescription.Parsec
+import qualified Distribution.Types.CondTree as CT
 import Language.Haskell.Extension
 import Ormolu.Config
 import Ormolu.Exception
 import System.Directory
 import System.FilePath
+import System.IO (hPutStrLn, stderr)
 import System.IO.Error (isDoesNotExistError)
 
 -- | Get a map from Haskell source file paths (without any extensions)
@@ -49,12 +50,17 @@
       buildMap extractFromBenchmark . snd <$> condBenchmarks
     ]
   where
-    buildMap f a = let (files, exts) = f (condTreeData a) in M.fromList $ (,exts) <$> files
+    buildMap f a = let (files, exts) = f mergedA in M.fromList $ (,exts) <$> files
+      where
+        (mergedA, _) = CT.ignoreConditions a
 
     extractFromBuildInfo extraModules BuildInfo {..} = (,exts) $ do
       m <- extraModules ++ (ModuleName.toFilePath <$> otherModules)
-      (takeDirectory cabalFile </>) . (</> dropExtensions m) <$> hsSourceDirs
+      (takeDirectory cabalFile </>) <$> prependSrcDirs (dropExtensions m)
       where
+        prependSrcDirs f
+          | null hsSourceDirs = [f]
+          | otherwise = (</> f) <$> hsSourceDirs
         exts = maybe [] langExt defaultLanguage ++ fmap extToDynOption defaultExtensions
         langExt =
           pure . DynOption . \case
@@ -94,11 +100,19 @@
   m (Maybe FilePath)
 findCabalFile p = liftIO $ do
   let parentDir = takeDirectory p
-  ps <-
+  dirEntries <-
     listDirectory parentDir `catch` \case
       (isDoesNotExistError -> True) -> pure []
       e -> throwIO e
-  case find ((== ".cabal") . takeExtension) ps of
+  let findDotCabal = \case
+        [] -> pure Nothing
+        e : es
+          | takeExtension e == ".cabal" ->
+            doesFileExist (parentDir </> e) >>= \case
+              True -> pure $ Just e
+              False -> findDotCabal es
+        _ : es -> findDotCabal es
+  findDotCabal dirEntries >>= \case
     Just cabalFile -> pure . Just $ parentDir </> cabalFile
     Nothing ->
       if isDrive parentDir
@@ -114,9 +128,18 @@
   m [DynOption]
 getCabalExtensionDynOptions sourceFile' = liftIO $ do
   sourceFile <- makeAbsolute sourceFile'
-  mCabalFile <- findCabalFile sourceFile
-  case mCabalFile of
+  findCabalFile sourceFile >>= \case
     Just cabalFile -> do
       extsByFile <- getExtensionsFromCabalFile cabalFile
-      pure $ M.findWithDefault [] (dropExtensions sourceFile) extsByFile
-    Nothing -> pure []
+      case M.lookup (dropExtensions sourceFile) extsByFile of
+        Just exts -> pure exts
+        Nothing -> do
+          relativeCabalFile <- makeRelativeToCurrentDirectory cabalFile
+          note $
+            "Found .cabal file "
+              <> relativeCabalFile
+              <> ", but it did not mention "
+              <> sourceFile'
+    Nothing -> note $ "Could not find a .cabal file for " <> sourceFile'
+  where
+    note msg = [] <$ hPutStrLn stderr msg
diff --git a/tests/Ormolu/CabalExtensionsSpec.hs b/tests/Ormolu/CabalExtensionsSpec.hs
--- a/tests/Ormolu/CabalExtensionsSpec.hs
+++ b/tests/Ormolu/CabalExtensionsSpec.hs
@@ -3,6 +3,9 @@
 import qualified Data.Map as M
 import Ormolu.Config
 import Ormolu.Utils.Extensions
+import System.Directory
+import System.FilePath
+import System.IO.Temp (withSystemTempDirectory)
 import Test.Hspec
 
 spec :: Spec
@@ -23,5 +26,10 @@
           cabalFile `shouldBe` Just expectedCabalFile
     findsOrmoluCabal "src/Ormolu/Config.hs" "./ormolu.cabal"
     findsOrmoluCabal "a/b/c/d/e" "./ormolu.cabal"
+  it "do not consider directories as .cabal files" $
+    withSystemTempDirectory "" $ \dir -> do
+      createDirectory $ dir </> ".cabal"
+      cabalFile <- findCabalFile $ dir </> "foo/bar.hs"
+      cabalFile `shouldBe` Nothing
   where
     members as m = all (`M.member` m) as
